[FFmpeg-devel] [RFC/PATCH] Dealing with 0 padded audio packets
Michael Niedermayer
michaelni
Wed May 19 02:06:14 CEST 2010
On Tue, May 18, 2010 at 06:16:35PM -0400, Alex Converse wrote:
> Currently the FFmpeg stumbles when decoding AAC where the container
> has zero padded audio frames to make a constant packet size. This
> situation is common for AAC in ASF[1] and WMP handles it fine.
> QuickTime seems to handle the MP4 analog fine.
>
> The best idea I can come up with is a chomp[2] bitstream filter to
> trim these when remuxing and to make the AAC decoder consume the rest
> of a packet if it is all zero.
>
> Other ideas are welcome.
i wish i had a better idea, but i dont.
no real objections from me on this, just 2 nitpicks below
[...]
>
> @@ -2065,6 +2066,12 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data,
> ac->output_configured = OC_LOCKED;
>
> buf_consumed = (get_bits_count(&gb) + 7) >> 3;
> + i = buf_consumed;
> + while (i < buf_size && !buf[i])
> + i++;
> + if (i == buf_size)
> + buf_consumed = buf_size;
> +
> return buf_size > buf_consumed ? buf_consumed : buf_size;
this can be done less convoluted i think
[...]
> +static int chomp_filter(AVBitStreamFilterContext *bsfc,
> + AVCodecContext *avctx, const char *args,
> + uint8_t **poutbuf, int *poutbuf_size,
> + const uint8_t *buf, int buf_size,
> + int keyframe)
> +{
> + int i = buf_size;
> + while (i > 0 && !buf[i-1])
> + i--;
> +
> + *poutbuf = (uint8_t*) buf;
> + *poutbuf_size = i;
you dont need i, buf_size should do
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100519/c6805119/attachment.pgp>
More information about the ffmpeg-devel
mailing list