[Ffmpeg-devel] Stream file handle hijacking by another thread

Måns Rullgård mans
Mon Feb 26 00:41:05 CET 2007

"Stas Oskin" <stas.oskin at gmail.com> writes:

> Hi.
> Sorry for the delay in reply, needed more time to analyze.
>> Could you try running the attached program?  It might verify that the
>> thread library is indeed broken.
> Thanks, it works fine, and so the parts I re-wrote. After some digging
> I found the 0 file descriptor effect happens because of the encoding
> resuming mechanism I'm using (not clear why but I'll split it to a
> separate thread).
> I discovered how the encoding issues begin. After a hour or so of good
> writing, the av_write_frame returns an error, and perror(errnum) gives
> "bad file descriptor". After this any subsequent write attempts fail.
> This happens only for some threads - others work fine.
> This happens on 2 different machines (1 of them brand new), so the
> possibility it's a bad disk is very low.
> Has anyone encountered something similar on any configuration/OS?

It sounds like you've got your threads mixed up, and one of them is
closing a file descriptor belonging to another.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list