[Libav-user] Segfault on corrupted video

Tim Pitman tapitman11 at gmail.com
Thu Jun 28 01:58:57 CEST 2012


I was relying on the return value from avcodec_decode_video2.
Basically I assumed that if it was > 0 then the picture was valid.
However, I was curious about what got_picture was for so if changed:

if (ret > 0)


if (ret > 0 && got_picture)

It no longer crashes, but instead seems to freeze for a few seconds,
which is definitely a big step in the right direction.

What is the difference between the return value and got_picture?


On Wed, Jun 27, 2012 at 12:59 PM, Tim Pitman <tapitman11 at gmail.com> wrote:
> After continued debugging I've narrowed things down somewhat. after
> getting a picture from avcodec_decode_video2, I pass the data from the
> picture to glTexImage2D, which is what
> seems to be crashing. When I backtrace with gdb it says the the
> address stored in picture->data[0]
> is out of bounds. So I'm guessing that the unref error coming from
> libavcodec isn't what's actually crashing,
> but it's related. Any ideas? Can someone provide more info about what
> normally causes unref short errors?
> Thanks,
> Tim
> On Tue, Jun 26, 2012 at 1:57 PM, Tim Pitman <tapitman11 at gmail.com> wrote:
>> After using gdb to run a backtrace it looks like my problem may be in
>> my OpenGL rendering. Sorry about that.
>> However, I still have one general question: When it comes to error
>> detection in situations like this, is dropping corrupted data at the
>> NALU level a good way to go, or is there a better way? Would I get
>> much advantage from encapsulating in RTP packets?
>> Thanks,
>> Tim
>> On Tue, Jun 26, 2012 at 1:51 PM, Tim Pitman <tapitman11 at gmail.com> wrote:
>>> Ok, I did some more testing, and the problem is not reproducible with
>>> either ffmpeg or ffplay. I created a dump of the corrupted video
>>> stream. When I play it back through my player it crashes but ffplay
>>> just throws some new errors and then stops and the end of the video.
>>> Any ideas?
>>> On Tue, Jun 26, 2012 at 12:35 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>>>> Tim Pitman <tapitman11 at ...> writes:
>>>>> There are lots of errors but mostly they just result in
>>>>> artifacts, which is exactly what I want to happen. However,
>>>>> when the channel is bad libav segfaults with:
>>>>> mmco: unref short failure
>>>> (Crashes are always important bugs)
>>>> Can you reproduce the bug with ffmpeg (instead of using your application)?
>>>> Please confirm that you are using current git head from
>>>> http://ffmpeg.org/download.html and please provide backtrace etc.
>>>> as explained on http://ffmpeg.org/bugreports.html
>>>> Carl Eugen
>>>> _______________________________________________
>>>> Libav-user mailing list
>>>> Libav-user at ffmpeg.org
>>>> http://ffmpeg.org/mailman/listinfo/libav-user

More information about the Libav-user mailing list