[Ffmpeg-devel] Stream file handle hijacking by another thread
Stas Oskin
stas.oskin
Sun Feb 18 12:16:08 CET 2007
Hi again.
>If you get this you obviously have not.
>You get this message only if the sum of threads executing one of either
>avcodec_open or avcodec_close is > 1.
I resolved the threading issues, but I'm still receiving errors from
av_write_frame(), and several threads are still writing to the same
file. After several debug sessions, I found the source of these
errors:
static int file_write(URLContext *h, unsigned char *buf, int size)
{
int fd = (size_t)h->priv_data;
return write(fd, buf, size);
}
Apparently, the h->priv_data somehow resets to 0x0, which in turn sets
the file descriptor to 0 as well. This leads to the mentioned errors,
and apparently to the bug of several threads writing to same file.
I also checked for errno messages:
Bad file descriptor - appears on the first write error
Operation not permitted - appears for any subsequent write error
I think this might be a threading bug in libavcodec, but it's weird it
got undetected so far. Any help to pinpoint the issue will be greatly
appreciated.
More information about the ffmpeg-devel
mailing list