[vlc-devel] [PATCH] MPEG4 Audio Packetizer : Send atleast one frame without the ADTS header stripped off in the absence of decoder config extradata.
Jai Menon
jmenon86 at gmail.com
Sat Jul 31 16:22:26 CEST 2010
This is useful when we don't have an MPEG4AudioDecoderConfig available
at the time of codec initialization. We construct one later in the
packetizer but codecs like the libavcodec based AAC decoder, for example,
won't pick that up.
---
modules/packetizer/mpeg4audio.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index 3e4561c..1afdbf5 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -138,6 +138,7 @@ struct decoder_sys_t
/* LOAS */
bool b_latm_cfg;
latm_mux_t latm;
+ bool send_initial_adts_header;
};
enum {
@@ -258,6 +259,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
/* Set callback */
p_dec->pf_packetize = PacketizeRawBlock;
p_sys->i_type = TYPE_RAW;
+ p_sys->send_initial_adts_header = false;
}
else
{
@@ -272,6 +274,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
/* Set callback */
p_dec->pf_packetize = PacketizeStreamBlock;
p_sys->i_type = TYPE_NONE;
+ p_sys->send_initial_adts_header = true;
}
return VLC_SUCCESS;
@@ -1143,6 +1146,17 @@ static block_t *PacketizeStreamBlock( decoder_t *p_dec, block_t **pp_block )
/* When we reach this point we already know we have enough
* data available. */
+ if( p_sys->send_initial_adts_header )
+ {
+ p_out_buffer = block_New( p_dec, p_sys->i_frame_size + p_sys->i_header_size);
+ if( !p_out_buffer )
+ return NULL;
+ block_GetBytes( &p_sys->bytestream, p_out_buffer->p_buffer,
+ p_sys->i_frame_size + p_sys->i_header_size);
+ p_sys->send_initial_adts_header = false;
+ }
+ else
+ {
p_out_buffer = block_New( p_dec, p_sys->i_frame_size );
if( !p_out_buffer )
{
@@ -1176,6 +1190,7 @@ static block_t *PacketizeStreamBlock( decoder_t *p_dec, block_t **pp_block )
break;
}
}
+ }
SetupOutput( p_dec, p_out_buffer );
/* Make sure we don't reuse the same pts twice */
if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts )
--
1.7.1.1
More information about the vlc-devel
mailing list