Skip to content

Commit 184416a

Browse files
shahdDaghashtonihei
authored andcommitted
Prevent metricsReporter.reportMetrics() from throwing
In general, metrics collection should not lead to Transformer thorwing and crashing the app. PiperOrigin-RevId: 739099456 (cherry picked from commit 3f5019b)
1 parent aea0637 commit 184416a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

libraries/transformer/src/main/java/androidx/media3/transformer/EditingMetricsCollector.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package androidx.media3.transformer;
1818

19-
import static androidx.media3.common.util.Assertions.checkState;
2019
import static androidx.media3.common.util.Util.usToMs;
2120

2221
import android.content.Context;
@@ -102,8 +101,7 @@ private DefaultMetricsReporter(Context context) {
102101

103102
@Override
104103
public void reportMetrics(EditingEndedEvent editingEndedEvent) {
105-
checkState(!metricsReported, "Metrics have already been reported.");
106-
if (editingSession != null) {
104+
if (!metricsReported && editingSession != null) {
107105
editingSession.reportEditingEndedEvent(editingEndedEvent);
108106
metricsReported = true;
109107
}

0 commit comments

Comments
 (0)