[FFmpeg-devel] [PATCH] Make RM demuxer behave better with -an option

Kostya kostya.shishkov
Mon Mar 2 08:02:52 CET 2009

On Sun, Mar 01, 2009 at 05:48:18PM -0500, Ronald S. Bultje wrote:
> Hi Kostya,
> 2009/2/2 Kostya <kostya.shishkov at gmail.com>:
> > The story so far:
> > ?FFmpeg now has RV30, RV40 (my fault) and AAC (not my fault) support. When
> > trying to decode RV40+AAC RM file with -an option video decoder produces
> > a lot of garbage and may crash. As I've investigated, that happens because
> > with -an option specified RM demuxer begins to feed audio packets to video
> > decoder.
> >
> > ?With this patch demuxer resets the number of pending audio packets (so they
> > won't be demuxed) and skips them (syncing to the next packet header tends to
> > produce false positive matches somewhere inside packet data).
> Does this fix it? It's a simpler solution that would allow me to move
> the other codecs than AAC to use get_buffer() instead of memcpy() in
> ff_rm_retrieve_cache() also. For now, it doesn't make the demuxer more
> complicated, it fixes this bug and most importantly, it eventually
> (after release) allows simplification of the demuxer.
> Ronald

Yes, this patch works.

As for replacing memcpy() with get_buffer() - that's unlikely. RM format
developers introduced scrambling, so you have to read several audio packets
to construct proper subpacket sequence (for example, typical first cook packet
contains 1st, 8th, 16th and 24th subpacket).

The only obvious simplification I see for now is merging old and new format
demuxing - the only difference is that old format does not contain packet
headers and audio only (exactly like .wav and .avi).

More information about the ffmpeg-devel mailing list