[x265] input: fix race condition
Satoshi Nakagawa
nakagawa424 at oki.com
Sat Jun 21 11:45:13 CEST 2014
# 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
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;
More information about the x265-devel
mailing list