mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Create ExportException for audio from UnhandledAudioFormatException.
All audio processing export errors are related to a UAFE - passing audioFormat separately is redundant. PiperOrigin-RevId: 549427685
This commit is contained in:
parent
cdb174c91a
commit
beceb996ac
3 changed files with 9 additions and 8 deletions
|
|
@ -106,7 +106,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||||
try {
|
try {
|
||||||
reconfigureProcessingForPendingMediaItem();
|
reconfigureProcessingForPendingMediaItem();
|
||||||
} catch (AudioProcessor.UnhandledAudioFormatException e) {
|
} catch (AudioProcessor.UnhandledAudioFormatException e) {
|
||||||
throw ExportException.createForAudioProcessing(e, e.inputAudioFormat);
|
throw ExportException.createForAudioProcessing(e, "AudioGraph reconfiguration");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ import org.checkerframework.dataflow.qual.Pure;
|
||||||
try {
|
try {
|
||||||
audioGraph = new AudioGraph(firstExporterInputFormat, firstEditedMediaItem);
|
audioGraph = new AudioGraph(firstExporterInputFormat, firstEditedMediaItem);
|
||||||
} catch (AudioProcessor.UnhandledAudioFormatException e) {
|
} catch (AudioProcessor.UnhandledAudioFormatException e) {
|
||||||
throw ExportException.createForAudioProcessing(e, e.inputAudioFormat);
|
throw ExportException.createForAudioProcessing(e, "AudioGraph initialization");
|
||||||
}
|
}
|
||||||
encoderInputAudioFormat = audioGraph.getOutputAudioFormat();
|
encoderInputAudioFormat = audioGraph.getOutputAudioFormat();
|
||||||
checkState(!encoderInputAudioFormat.equals(AudioFormat.NOT_SET));
|
checkState(!encoderInputAudioFormat.equals(AudioFormat.NOT_SET));
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
import androidx.media3.common.VideoFrameProcessingException;
|
import androidx.media3.common.VideoFrameProcessingException;
|
||||||
import androidx.media3.common.VideoFrameProcessor;
|
import androidx.media3.common.VideoFrameProcessor;
|
||||||
import androidx.media3.common.audio.AudioProcessor.AudioFormat;
|
import androidx.media3.common.audio.AudioProcessor.UnhandledAudioFormatException;
|
||||||
import androidx.media3.common.util.Clock;
|
import androidx.media3.common.util.Clock;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
|
|
@ -283,14 +283,15 @@ public final class ExportException extends Exception {
|
||||||
/**
|
/**
|
||||||
* Creates an instance for an audio processing related exception.
|
* Creates an instance for an audio processing related exception.
|
||||||
*
|
*
|
||||||
* @param cause The cause of the failure.
|
* @param exception The cause of the failure.
|
||||||
* @param audioFormat The {@link AudioFormat} used.
|
* @param details The details associated with this exception.
|
||||||
* @return The created instance.
|
* @return The created instance.
|
||||||
*/
|
*/
|
||||||
public static ExportException createForAudioProcessing(Throwable cause, AudioFormat audioFormat) {
|
public static ExportException createForAudioProcessing(
|
||||||
|
UnhandledAudioFormatException exception, String details) {
|
||||||
return new ExportException(
|
return new ExportException(
|
||||||
"Audio processing error, audio_format=" + audioFormat,
|
"Audio error: " + details + ", audioFormat=" + exception.inputAudioFormat,
|
||||||
cause,
|
exception,
|
||||||
ERROR_CODE_AUDIO_PROCESSING_FAILED);
|
ERROR_CODE_AUDIO_PROCESSING_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue