OSDN Git Service

Fix index generation in the way that it was supposed to be used. See the
authorRonald S. Bultje <rsbultje@gmail.com>
Sun, 15 Mar 2009 20:14:25 +0000 (20:14 +0000)
committerRonald S. Bultje <rsbultje@gmail.com>
Sun, 15 Mar 2009 20:14:25 +0000 (20:14 +0000)
commit7a160bca8334d55a51e7256be8b6ae61302374b9
treeb1d7d552b14e97b8c6ea349aba578667002a0b4a
parentb2170247069184acd068b39f24dd8ef5d4e4e7a4
Fix index generation in the way that it was supposed to be used. See the
discussion in the ML thread "[PATCH] rmdec.c: merge old/new packet reading
code".

Over time, this code broke somewhat, e.g. seq was never actually written
into (and was thus always 1, therefore the seq condition was always true),
whereas it was supposed to be set to the sequence number of the video slice
in case the video frame is divided over multiple RM packets (slices). The
problem of this is that packets other than those containing the beginning
of a video frame would be indexed as well.
Secondly, flags&2 is supposed to be true for video keyframes and for these
audio packets containing the start of a block. For some codecs (e.g. AAC),
that is every single packet, whereas for others (e.g. cook), that is the
packet containing the first of a series of scrambled packets that are to be
descrambled together. Indexing any of the following would lead to incomplete
and thus useless frames. Problem here is that flags would be reset to 2 to
indicate that the first packet is ready to be returned, and in addition if
no data was left to be returned (which is always true for the first packet),
then we wouldn't actually write the index entry anyway.
All in all, the idea was good and it probably worked at some point, but that
is long ago. This patch should at the very least make it likely for this code
to be executed again at the right times, i.e. the way it was originally
intended to be used.

Originally committed as revision 17993 to svn://svn.ffmpeg.org/ffmpeg/trunk
libavformat/rmdec.c