|
1 | 1 | use crate::error::Result;
|
2 | 2 | use crate::{
|
3 |
| - compound_packet::*, error::Error, goodbye::*, header::*, |
4 |
| - payload_feedbacks::full_intra_request::*, payload_feedbacks::picture_loss_indication::*, |
| 3 | + error::Error, goodbye::*, header::*, payload_feedbacks::full_intra_request::*, |
| 4 | + payload_feedbacks::picture_loss_indication::*, |
5 | 5 | payload_feedbacks::receiver_estimated_maximum_bitrate::*,
|
6 | 6 | payload_feedbacks::slice_loss_indication::*, raw_packet::*, receiver_report::*,
|
7 | 7 | sender_report::*, source_description::*,
|
@@ -44,7 +44,7 @@ impl Clone for Box<dyn Packet + Send + Sync> {
|
44 | 44 | /// If this is a reduced-size RTCP packet a feedback packet (Goodbye, SliceLossIndication, etc)
|
45 | 45 | /// will be returned. Otherwise, the underlying type of the returned packet will be
|
46 | 46 | /// CompoundPacket.
|
47 |
| -pub fn unmarshal<B>(raw_data: &mut B) -> Result<Box<dyn Packet + Send + Sync>> |
| 47 | +pub fn unmarshal<B>(raw_data: &mut B) -> Result<Vec<Box<dyn Packet + Send + Sync>>> |
48 | 48 | where
|
49 | 49 | B: Buf,
|
50 | 50 | {
|
|
59 | 59 | // Empty Packet
|
60 | 60 | 0 => Err(Error::InvalidHeader),
|
61 | 61 |
|
62 |
| - // Single Packet |
63 |
| - 1 => packets.pop().ok_or(Error::BadFirstPacket), |
64 |
| - |
65 |
| - // Compound Packet |
66 |
| - _ => Ok(Box::new(CompoundPacket(packets))), |
| 62 | + // Multiple Packet |
| 63 | + _ => Ok(packets), |
67 | 64 | }
|
68 | 65 | }
|
69 | 66 |
|
@@ -187,13 +184,13 @@ mod test {
|
187 | 184 | media_ssrc: 0x902f9e2e,
|
188 | 185 | };
|
189 | 186 |
|
190 |
| - let expected: Box<dyn Packet + Send + Sync> = Box::new(CompoundPacket(vec![ |
| 187 | + let expected: Vec<Box<dyn Packet + Send + Sync>> = vec![ |
191 | 188 | Box::new(a),
|
192 | 189 | Box::new(b),
|
193 | 190 | Box::new(c),
|
194 | 191 | Box::new(d),
|
195 | 192 | Box::new(e),
|
196 |
| - ])); |
| 193 | + ]; |
197 | 194 |
|
198 | 195 | assert!(packet == expected, "Invalid packets");
|
199 | 196 | }
|
|
0 commit comments