зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1752326 - Prevent deadlock when stopping V4L2 capture. r=ng
This is effectively a cherry-pick of the upstream commit https://webrtc.googlesource.com/src/+/974f6c64388614c332671c98dec8fffc86f35acf . The effected code was a bit different upstream, so there are minor differences. Differential Revision: https://phabricator.services.mozilla.com/D138175
This commit is contained in:
Родитель
6019443efe
Коммит
45d8ff9056
|
@ -386,18 +386,6 @@ bool VideoCaptureModuleV4L2::CaptureProcess() {
|
|||
rSet.revents = 0;
|
||||
|
||||
retVal = poll(&rSet, 1, 1000);
|
||||
if (retVal < 0 && errno != EINTR) // continue if interrupted
|
||||
{
|
||||
// poll failed
|
||||
return false;
|
||||
} else if (retVal == 0) {
|
||||
// poll timed out
|
||||
return true;
|
||||
} else if (!(rSet.revents & POLLIN)) {
|
||||
// not event on camera handle
|
||||
return true;
|
||||
}
|
||||
|
||||
{
|
||||
MutexLock lock(&capture_lock_);
|
||||
|
||||
|
@ -405,6 +393,18 @@ bool VideoCaptureModuleV4L2::CaptureProcess() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (retVal < 0 && errno != EINTR) // continue if interrupted
|
||||
{
|
||||
// poll failed
|
||||
return false;
|
||||
} else if (retVal == 0) {
|
||||
// poll timed out
|
||||
return true;
|
||||
} else if (!(rSet.revents & POLLIN)) {
|
||||
// not event on camera handle
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_captureStarted) {
|
||||
struct v4l2_buffer buf;
|
||||
memset(&buf, 0, sizeof(struct v4l2_buffer));
|
||||
|
|
Загрузка…
Ссылка в новой задаче