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

Måns Rullgård mans
Sun Feb 18 15:02:24 CET 2007


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

>> 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 traced the issue to the begining, and have found the cause for the
> problem. Some of the file descriptors (fd) are set to 0 from the
> start, from the open() function:
>
> static int file_open(URLContext *h, const char *filename, int flags)
> {
> ...
>    fd = open(filename, access, 0666); /* fd gets 0 */
> ...
>    h->priv_data = (void *)(size_t)fd; /* priv_data gets 0 as well */
> }
>
> This happens for several threads in the same process. AFAIK open()
> should gurantee unique fd, but this is not the case here.
>
> Can anyone advice what should be done here?

Fix your thread library.  It is obviously horribly broken.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list