Prevent metricsReporter.reportMetrics() from throwing

In general, metrics collection should not lead to Transformer thorwing and crashing the app.

PiperOrigin-RevId: 739099456
This commit is contained in:
shahddaghash 2025-03-21 02:00:53 -07:00 committed by Copybara-Service
parent 6280ab24c2
commit 3f5019b908

View File

@ -16,7 +16,6 @@
package androidx.media3.transformer;
import static androidx.media3.common.util.Assertions.checkState;
import static androidx.media3.common.util.Util.usToMs;
import android.content.Context;
@ -102,8 +101,7 @@ import java.util.List;
@Override
public void reportMetrics(EditingEndedEvent editingEndedEvent) {
checkState(!metricsReported, "Metrics have already been reported.");
if (editingSession != null) {
if (!metricsReported && editingSession != null) {
editingSession.reportEditingEndedEvent(editingEndedEvent);
metricsReported = true;
}