@@ -176,11 +176,7 @@ pub fn packetize(obus: &Vec<Obu>, mtu: usize) -> Vec<PacketMetadata> {
176
176
177
177
/// Returns the aggregation header for the packet.
178
178
/// Reference: https://aomediacodec.github.io/av1-rtp-spec/#44-av1-aggregation-header
179
- pub fn get_aggregation_header (
180
- obus : & Vec < Obu > ,
181
- packets : & Vec < PacketMetadata > ,
182
- packet_index : usize ,
183
- ) -> u8 {
179
+ pub fn get_aggregation_header ( obus : & [ Obu ] , packets : & [ PacketMetadata ] , packet_index : usize ) -> u8 {
184
180
let packet = & packets[ packet_index] ;
185
181
let mut header: u8 = 0 ;
186
182
@@ -233,11 +229,9 @@ pub fn get_aggregation_header(
233
229
/// Returns the number of additional bytes needed to store the previous OBU
234
230
/// element if an additional OBU element is added to the packet.
235
231
fn additional_bytes_for_previous_obu_element ( packet : & PacketMetadata ) -> usize {
236
- if packet. packet_size == 0 {
237
- // Packet is still empty => no last OBU element, no need to reserve space
238
- // for it.
239
- 0
240
- } else if packet. num_obu_elements > MAX_NUM_OBUS_TO_OMIT_SIZE {
232
+ if packet. packet_size == 0 || packet. num_obu_elements > MAX_NUM_OBUS_TO_OMIT_SIZE {
233
+ // Packet is still empty => no last OBU element, no need to reserve space for it.
234
+ // OR
241
235
// There are so many obu elements in the packet, all of them must be
242
236
// prepended with the length field. That imply space for the length of the
243
237
// last obu element is already reserved.
@@ -256,7 +250,7 @@ fn max_fragment_size(remaining_bytes: usize) -> usize {
256
250
}
257
251
let mut i = 1 ;
258
252
loop {
259
- if remaining_bytes < ( 1 << 7 * i) + i {
253
+ if remaining_bytes < ( 1 << ( 7 * i) ) + i {
260
254
return remaining_bytes - i;
261
255
}
262
256
i += 1 ;
0 commit comments