Log export errors that occur after export completes
PiperOrigin-RevId: 518281002
This commit is contained in:
parent
0a9a758079
commit
8df4fd769c
@ -627,9 +627,7 @@ public final class TransformerActivity extends AppCompatActivity {
|
||||
"exportStopwatch",
|
||||
})
|
||||
private void onError(ExportException exportException) {
|
||||
if (exportStopwatch.isRunning()) {
|
||||
exportStopwatch.stop();
|
||||
}
|
||||
exportStopwatch.stop();
|
||||
informationTextView.setText(R.string.export_error);
|
||||
progressViewGroup.setVisibility(View.GONE);
|
||||
debugFrame.removeAllViews();
|
||||
|
@ -418,7 +418,12 @@ public final class Transformer {
|
||||
}
|
||||
}
|
||||
|
||||
/** A listener for the export events. */
|
||||
/**
|
||||
* A listener for the export events.
|
||||
*
|
||||
* <p>If the export is not cancelled, either {@link #onError} or {@link #onCompleted} will be
|
||||
* called once for each export.
|
||||
*/
|
||||
public interface Listener {
|
||||
|
||||
/**
|
||||
|
@ -34,6 +34,7 @@ import android.content.Context;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.C;
|
||||
@ -90,6 +91,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
private static final int MSG_END = 3;
|
||||
private static final int MSG_UPDATE_PROGRESS = 4;
|
||||
|
||||
private static final String TAG = "TransformerInternal";
|
||||
private static final int DRAIN_PIPELINES_DELAY_MS = 10;
|
||||
|
||||
private final Context context;
|
||||
@ -322,6 +324,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
|
||||
boolean forCancellation = endReason == END_REASON_CANCELLED;
|
||||
@Nullable ExportException releaseExportException = null;
|
||||
boolean releasedPreviously = released;
|
||||
if (!released) {
|
||||
released = true;
|
||||
for (int i = 0; i < sequenceAssetLoaders.size(); i++) {
|
||||
@ -378,12 +381,19 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
}
|
||||
|
||||
if (exception != null) {
|
||||
if (releasedPreviously) {
|
||||
Log.e(TAG, "Export error after export ended: ", exception);
|
||||
return;
|
||||
}
|
||||
ExportException finalException = exception;
|
||||
applicationHandler.post(
|
||||
() ->
|
||||
listener.onError(
|
||||
exportResultBuilder.setExportException(finalException).build(), finalException));
|
||||
} else {
|
||||
if (releasedPreviously) {
|
||||
return;
|
||||
}
|
||||
applicationHandler.post(() -> listener.onCompleted(exportResultBuilder.build()));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user