Commit 1402bd6f by kimvde Committed by Andrew Lewis

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
parent 6e305936
...@@ -112,6 +112,8 @@ ...@@ -112,6 +112,8 @@
* Add `TransformationRequest` for specifying the transformation options. * Add `TransformationRequest` for specifying the transformation options.
* Allow multiple listeners to be registered. * Allow multiple listeners to be registered.
* Fix Transformer being stuck when the codec output is partially read. * Fix Transformer being stuck when the codec output is partially read.
* Fix potential NPE in `Transformer.getProgress` when releasing the muxer
throws.
* MediaSession extension: * MediaSession extension:
* Remove deprecated call to `onStop(/* reset= */ true)` and provide an * 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. opt-out flag for apps that don't want to clear the playlist on stop.
......
...@@ -774,6 +774,7 @@ public final class Transformer { ...@@ -774,6 +774,7 @@ public final class Transformer {
*/ */
private void releaseResources(boolean forCancellation) throws TransformationException { private void releaseResources(boolean forCancellation) throws TransformationException {
verifyApplicationThread(); verifyApplicationThread();
progressState = PROGRESS_STATE_NO_TRANSFORMATION;
if (player != null) { if (player != null) {
player.release(); player.release();
player = null; player = null;
...@@ -787,7 +788,6 @@ public final class Transformer { ...@@ -787,7 +788,6 @@ public final class Transformer {
} }
muxerWrapper = null; muxerWrapper = null;
} }
progressState = PROGRESS_STATE_NO_TRANSFORMATION;
} }
private void verifyApplicationThread() { private void verifyApplicationThread() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment