Fix NPE in Transformer.getProgress()

If muxerWrapper.release() was throwing an exception, the progress state
was not updated and getProgress could throw an exception.

#minor-release

PiperOrigin-RevId: 424696783
This commit is contained in:
kimvde 2022-01-27 21:40:34 +00:00 committed by Andrew Lewis
parent 6e305936b8
commit 1402bd6f54
2 changed files with 3 additions and 1 deletions

View File

@ -112,6 +112,8 @@
* Add `TransformationRequest` for specifying the transformation options.
* Allow multiple listeners to be registered.
* Fix Transformer being stuck when the codec output is partially read.
* Fix potential NPE in `Transformer.getProgress` when releasing the muxer
throws.
* MediaSession extension:
* Remove deprecated call to `onStop(/* reset= */ true)` and provide an
opt-out flag for apps that don't want to clear the playlist on stop.

View File

@ -774,6 +774,7 @@ public final class Transformer {
*/
private void releaseResources(boolean forCancellation) throws TransformationException {
verifyApplicationThread();
progressState = PROGRESS_STATE_NO_TRANSFORMATION;
if (player != null) {
player.release();
player = null;
@ -787,7 +788,6 @@ public final class Transformer {
}
muxerWrapper = null;
}
progressState = PROGRESS_STATE_NO_TRANSFORMATION;
}
private void verifyApplicationThread() {