MPEG seek crash (was: [Ffmpeg-devel] Re: Compiling FFmpeg using ISO/C89 compiler)

Steve Lhomme steve.lhomme
Mon Dec 11 16:27:40 CET 2006


Steve Lhomme wrote:
> Michael Niedermayer wrote:
>> Hi
>>
>> On Sat, Dec 09, 2006 at 05:47:55PM +0100, Reimar D?ffinger wrote:
>>> Hello,
>>> On Sat, Dec 09, 2006 at 05:09:50PM +0100, Michael Niedermayer wrote:
>>>> On Sat, Dec 09, 2006 at 12:07:34PM +0100, Reimar D?ffinger wrote:
>>>>> On Fri, Dec 08, 2006 at 05:28:57PM +0100, Baptiste Coudurier wrote:
>>>>>> If my chems1.vob is the same one, and anyway it should not crash 
>>>>>> indeed.
>>>>>> I confirm that ffplay_g crash with current svn.
>>>>>>
>>>>>> Log attached. Hope this helps.
>>>>> Can you test attached patch? I guess it is a bit hackish, but I'd 
>>>>> really
>>>>> like to know what kind of effect it has *g*
>>>>>
>>>>> Greetings,
>>>>> Reimar D?ffinger
>>>>> Index: libavcodec/mpegvideo.c
>>>>> ===================================================================
>>>>> --- libavcodec/mpegvideo.c    (revision 7261)
>>>>> +++ libavcodec/mpegvideo.c    (working copy)
>>>>> @@ -3905,6 +3905,8 @@
>>>>>          return;
>>>>>      }
>>>>>  #endif
>>>>> +    if (!s->last_picture.data) s->mv_dir &= ~MV_DIR_FORWARD;
>>>>> +    if (!s->next_picture.data) s->mv_dir &= ~MV_DIR_BACKWARD;
>>>>>  
>>>> IMHO if either reference frame of a b frame is unavailable then either
>>>> A. drop it (easy and logic, and not terribly noticeable)
>>>> B. for every MB
>>>>     * if its bidir drop the vector for an unavailable frame
>>>>     * if its forward or backward and the reference is unavailable
>>>>       flip the motion vector (* -1 * difference in temporal distance)
>>>>     * if neither reference is available drop the b frame
>>>> C. some more complex temporal iterpolation based on available motion 
>>>> vectors
>>>>
>>>> and my guess would be that B would look bad for most mpeg2 files as 
>>>> most
>>>> mpeg2 encoders are trash and select bad motion vectors ...
>>> So just
>>> if (s->mv_dir & MV_DIR_FORWARD && !s->last_picture.data) return;
>>> if (s->mv_dir & MV_DIR_BACKWARD && !s->next_picture.data) return;
>>>
>>> Instead of the above?
>>
>> iam more thinking of
>> if(s->pict_type == B_TYPE){
>>     if(!s->last_picture.data || !s->next_picture.data)
>>         return -1;
>> }
>> after decoding the header, assumng we are on the right track at all ...
>>
>>
>>> Either way, I do not yet even know if either one helps at all *g*
>>
>> neither do i ...
> 
> None of these solution work here. The last one crashes less often (after 
> more seeking), but I only tried a few times each.

PS: The code never go in any of these cases.
PPS: The function is void so should not return a value.

Steve





More information about the ffmpeg-devel mailing list