[x265] input: fix race condition
Satoshi Nakagawa
nakagawa424 at oki.com
Sun Jun 22 03:49:27 CEST 2014
When eof detected, threadMain may overwrite frameStat[tail.get()] = false
before read, no head check here.
So, I moved frameStat[] = false to consumer.
> -----Original Message-----
> From: x265-devel [mailto:x265-devel-bounces at videolan.org] On Behalf Of
> Steve Borho
> Sent: Sunday, June 22, 2014 1:29 AM
> To: Development for x265
> Subject: Re: [x265] input: fix race condition
>
> On Sat, Jun 21, 2014 at 4:45 AM, Satoshi Nakagawa <nakagawa424 at oki.com>
> wrote:
> > # HG changeset patch
> > # User Satoshi Nakagawa <nakagawa424 at oki.com> # Date 1403343771 -32400
> > # Sat Jun 21 18:42:51 2014 +0900
> > # Node ID 31e1104b97521bde2abe64a3f91d63e673f95c90
> > # Parent fe370292c232ec9a629d191791271b71c1c6f354
> > input: fix race condition
>
> Can you describe the bug this fixes, is there a network filesystem
> involved?
>
> > diff -r fe370292c232 -r 31e1104b9752 source/input/y4m.cpp
> > --- a/source/input/y4m.cpp Fri Jun 20 16:41:11 2014 -0700
> > +++ b/source/input/y4m.cpp Sat Jun 21 18:42:51 2014 +0900
> > @@ -390,7 +390,6 @@
> > /* "open the throttle" at the end, allow reader to consume
> > * remaining valid queue entries */
> > threadActive = false;
> > - frameStat[tail.get()] = false;
> > tail.set(QUEUE_SIZE);
> > }
> >
> > @@ -406,7 +405,7 @@
> > {
> > curTail = tail.waitForChange(curTail);
> > if (!threadActive)
> > - return false;
> > + break;
> > }
> >
> > #else
> > @@ -417,6 +416,7 @@
> >
> > if (!frameStat[curHead])
> > return false;
> > + frameStat[curHead] = false;
> >
> > pic.bitDepth = depth;
> > pic.colorSpace = colorSpace;
> > diff -r fe370292c232 -r 31e1104b9752 source/input/yuv.cpp
> > --- a/source/input/yuv.cpp Fri Jun 20 16:41:11 2014 -0700
> > +++ b/source/input/yuv.cpp Sat Jun 21 18:42:51 2014 +0900
> > @@ -182,7 +182,6 @@
> > }
> >
> > threadActive = false;
> > - frameStat[tail.get()] = false;
> > tail.set(QUEUE_SIZE);
> > }
> >
> > @@ -218,7 +217,7 @@
> > {
> > curTail = tail.waitForChange(curTail);
> > if (!threadActive)
> > - return false;
> > + break;
> > }
> >
> > #else
> > @@ -229,6 +228,7 @@
> >
> > if (!frameStat[curHead])
> > return false;
> > + frameStat[curHead] = false;
> >
> > pic.colorSpace = colorSpace;
> > pic.bitDepth = depth;
> > _______________________________________________
> > x265-devel mailing list
> > x265-devel at videolan.org
> > https://mailman.videolan.org/listinfo/x265-devel
>
>
>
> --
> Steve Borho
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
More information about the x265-devel
mailing list