[FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created

XinZheng Zhang zhangxzheng at gmail.com
Thu Jul 21 06:59:42 EEST 2016


On Thu, Jul 21, 2016 at 5:03 AM, Moritz Barsnick <barsnick at gmx.net> wrote:
> On Thu, Jul 21, 2016 at 00:06:44 +0800, zhangxinzheng wrote:
>
>> Subject: [FFmpeg-devel] [PATCH] avformat/fivdec: cached keyframes before video or audio stream was created
>                                            ^^^ flv
>
>> There has an error when seeking in a flv file, which key frames was
>> sorted before video frame.
>> This ensures that all the key frames was cached, and add to
>> corresponding stream when it was created.
>
> Thanks to the grammar, I don't understand the intent of the patch.
> (Don't get me wrong, I'm not scorning your English, but it needs to be
> improved.)
>

In flvdec.c 420
case AMF_DATA_TYPE_OBJECT:
    if ((vstream || astream) && key &&
        ioc->seekable &&
        !strcmp(KEYFRAMES_TAG, key) && depth == 1)
        if (parse_keyframes_index(s, ioc, vstream ? vstream : astream,
                                  max_pos) < 0)

If the first packet we got is object, both vstream and astream are NULL,
that may prevent keyframe index being parsed.

This patch saves keyframe index before A/V streams are created.

The issue was introduced since 09ae7b81ea.

I have created a ticket #5729 with a sample attatched.

>>  #define RESYNC_BUFFER_SIZE (1<<20)
>>
>> +
>> +typedef struct FLVKeyFrame {
>
> Why the extra newline?
>

The extra newline has been removed in new patch.


More information about the ffmpeg-devel mailing list