File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -206,17 +206,22 @@ pub struct H264Packet {
206
206
impl Depacketizer for H264Packet {
207
207
/// depacketize parses the passed byte slice and stores the result in the H264Packet this method is called upon
208
208
fn depacketize ( & mut self , packet : & Bytes ) -> Result < Bytes > {
209
- if packet. len ( ) <= 2 {
209
+ if packet. len ( ) <= 1 {
210
210
return Err ( Error :: ErrShortPacket ) ;
211
211
}
212
212
213
- let mut payload = BytesMut :: new ( ) ;
214
-
215
213
// NALU Types
216
214
// https://tools.ietf.org/html/rfc6184#section-5.4
217
215
let b0 = packet[ 0 ] ;
218
216
let nalu_type = b0 & NALU_TYPE_BITMASK ;
219
217
218
+ // The AUD NALU can be size 2 (1 byte header, 1 byte payload)
219
+ if packet. len ( ) <= 2 && nalu_type != AUD_NALU_TYPE {
220
+ return Err ( Error :: ErrShortPacket ) ;
221
+ }
222
+
223
+ let mut payload = BytesMut :: new ( ) ;
224
+
220
225
match nalu_type {
221
226
1 ..=23 => {
222
227
if self . is_avc {
You can’t perform that action at this time.
0 commit comments