[vlc-commits] packetizer: mpeg4audio: handle padding
Francois Cartegnie
git at videolan.org
Sat Jul 22 01:44:42 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jul 22 01:40:40 2017 +0200| [b861d3b89878da03fe5b1333797130c915a4cd1e] | committer: Francois Cartegnie
packetizer: mpeg4audio: handle padding
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b861d3b89878da03fe5b1333797130c915a4cd1e
---
modules/packetizer/mpeg4audio.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index 9c5fc15503..a639123042 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -1126,10 +1126,24 @@ static block_t *PacketizeStreamBlock(decoder_t *p_dec, block_t **pp_block)
if ( (p_sys->i_type == TYPE_ADTS && !HasADTSHeader( p_header )) ||
(p_sys->i_type == TYPE_LOAS && !HasLoasHeader( p_header )) )
{
- msg_Dbg(p_dec, "emulated sync word "
- "(no sync on following frame)");
- p_sys->i_state = STATE_NOSYNC;
- block_SkipByte(&p_sys->bytestream);
+ /* Check spacial padding case. Failing if need more bytes is ok since
+ that should have been sent as a whole block */
+ if( block_PeekOffsetBytes(&p_sys->bytestream,
+ p_sys->i_frame_size + p_sys->i_header_size,
+ p_header, 3) == VLC_SUCCESS &&
+ p_header[0] == 0x00 &&
+ ((p_sys->i_type == TYPE_ADTS && HasADTSHeader( &p_header[1] )) ||
+ (p_sys->i_type == TYPE_LOAS && !HasLoasHeader( &p_header[1] ))))
+ {
+ p_sys->i_state = STATE_SEND_DATA;
+ }
+ else
+ {
+ msg_Dbg(p_dec, "emulated sync word (no sync on following frame)"
+ " 0x%"PRIx8" 0x%"PRIx8, p_header[0], p_header[1] );
+ p_sys->i_state = STATE_NOSYNC;
+ block_SkipByte(&p_sys->bytestream);
+ }
break;
}
More information about the vlc-commits
mailing list