Skip to content

Commit

Permalink
Move to Raptorq 2.0
Browse files Browse the repository at this point in the history
WARNING: encoding packets generated with raptorq < 2.0 cannot be decoded by the new version and vice-versa.
  • Loading branch information
ypo committed Mar 18, 2024
1 parent 0ae476f commit ec78606
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ flate2 = "1.0"
md5 = "0.7"
pyo3 = { version = "0.20", features = ["extension-module"], optional = true }
pyo3-log = { version = "0.9", optional = true }
raptorq = "1.8"
raptorq = "2.0"
raptor-code = "1.0.6"
opentelemetry = { version = "0.22", optional = true }
rand = "0.8"
Expand Down
6 changes: 3 additions & 3 deletions src/fec/raptorq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ impl FecEncoder for RaptorQEncoder {
fn encode(&self, data: &[u8]) -> crate::error::Result<Vec<Box<dyn FecShard>>> {
let symbol_aligned = data.len() % self.config.symbol_size() as usize;
let encoder = match data.len() % self.config.symbol_size() as usize {
0 => raptorq::SourceBlockEncoder::new2(0, &self.config.clone(), data),
0 => raptorq::SourceBlockEncoder::new(0, &self.config.clone(), data),
_ => {
let mut data = data.to_vec();
data.resize(
data.len() + (self.config.symbol_size() as usize - symbol_aligned),
0,
);
raptorq::SourceBlockEncoder::new2(0, &self.config.clone(), &data)
raptorq::SourceBlockEncoder::new(0, &self.config.clone(), &data)
}
};

Expand Down Expand Up @@ -105,7 +105,7 @@ impl RaptorQDecoder {
);

let block_length = nb_source_symbols as u64 * encoding_symbol_length as u64;
let decoder = raptorq::SourceBlockDecoder::new2(sbn as u8, &config, block_length);
let decoder = raptorq::SourceBlockDecoder::new(sbn as u8, &config, block_length);
RaptorQDecoder {
decoder,
data: None,
Expand Down

0 comments on commit ec78606

Please sign in to comment.