mirror of
https://github.com/androidx/media.git
synced 2025-05-10 09:12:16 +08:00
Open progress conditionVariable when quitting internal thread.
If getProgress is blocking whilst the internal thread calls endInternal (for error or success), the condition is never opened. Related to this, onCompleted and onError are therefore never surfaced to the app. progressState is accessed from application and internal threads, so should be marked volatile to prevent a thread caching the value. PiperOrigin-RevId: 565720184
This commit is contained in:
parent
fef16b05d9
commit
c4fb755283
@ -366,8 +366,12 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
internalHandler.post(internalHandlerThread::quitSafely);
|
||||
}
|
||||
|
||||
// Update progress before opening variable to avoid getProgress returning an invalid combination
|
||||
// of state and progress.
|
||||
progressState = PROGRESS_STATE_NOT_STARTED;
|
||||
transformerConditionVariable.open();
|
||||
|
||||
if (forCancellation) {
|
||||
transformerConditionVariable.open();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user