Remove ThreadUtils.waitUninterruptibly.

This method is an anti-pattern. Removes usage of the method from
CameraCapturer and deletes it.

Bug: webrtc:8456
Change-Id: I8a70ce968af412fa6e6b9308a9e05d6a8a1ba05d
Reviewed-on: https://webrtc-review.googlesource.com/46140
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21808}
This commit is contained in:
Sami Kalliomäki
2018-01-30 14:17:56 +01:00
committed by Commit Bot
parent 1a2f207485
commit 607f464b16
2 changed files with 7 additions and 12 deletions

View File

@ -143,17 +143,6 @@ public class ThreadUtils {
return result;
}
// TODO(sakal): This method is broken. It should be removed: crbug.com/webrtc/8456
@SuppressWarnings("WaitNotInLoop")
public static void waitUninterruptibly(final Object object) {
executeUninterruptibly(new BlockingOperation() {
@Override
public void run() throws InterruptedException {
object.wait();
}
});
}
/**
* Post |callable| to |handler| and wait for the result.
*/

View File

@ -350,7 +350,13 @@ abstract class CameraCapturer implements CameraVideoCapturer {
synchronized (stateLock) {
while (sessionOpening) {
Logging.d(TAG, "Stop capture: Waiting for session to open");
ThreadUtils.waitUninterruptibly(stateLock);
try {
stateLock.wait();
} catch (InterruptedException e) {
Logging.w(TAG, "Stop capture interrupted while waiting for the session to open.");
Thread.currentThread().interrupt();
return;
}
}
if (currentSession != null) {