Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFMpeg error with some flac files #10760

Closed
1 task
Tolriq opened this issue Nov 8, 2022 · 5 comments
Closed
1 task

FFMpeg error with some flac files #10760

Tolriq opened this issue Nov 8, 2022 · 5 comments
Assignees

Comments

@Tolriq
Copy link
Contributor

Tolriq commented Nov 8, 2022

ExoPlayer Version

2.18.1

Devices that reproduce the issue

All

Devices that do not reproduce the issue

None

Reproducible in the demo app?

Not tested

Reproduction steps

Play the file send by mail with the ffmpeg extension enabled.
Skip or wait until near the end of the file and see an error.

Expected result

No error (And no error with default Android mediacodec)

Actual result

ExoPlayerImplInternal - Playback error
                                                                               com.google.android.exoplayer2.ExoPlaybackException: FfmpegAudioRenderer error, index=0, format=Format(null, null, null, audio/flac, null, -1, null, [-1, -1, -1.0], [2, 48000]), format_supported=YES
                                                                                   at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:566)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                   at android.os.Looper.loopOnce(Looper.java:201)
                                                                                   at android.os.Looper.loop(Looper.java:288)
                                                                                   at android.os.HandlerThread.run(HandlerThread.java:67)
                                                                               Caused by: com.google.android.exoplayer2.ext.ffmpeg.FfmpegDecoderException: Unexpected decode error
                                                                                   at com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioDecoder.createUnexpectedDecodeException(FfmpegAudioDecoder.java:95)
                                                                                   at com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioDecoder.createUnexpectedDecodeException(FfmpegAudioDecoder.java:32)
                                                                                   at com.google.android.exoplayer2.decoder.SimpleDecoder.decode(SimpleDecoder.java:245)
                                                                                   at com.google.android.exoplayer2.decoder.SimpleDecoder.run(SimpleDecoder.java:202)
                                                                                   at com.google.android.exoplayer2.decoder.SimpleDecoder.access$000(SimpleDecoder.java:29)
                                                                                   at com.google.android.exoplayer2.decoder.SimpleDecoder$1.run(SimpleDecoder.java:73)
                                                                               Caused by: java.lang.IllegalArgumentException
                                                                                   at java.nio.Buffer.limit(Buffer.java:290)
                                                                                   at java.nio.ByteBuffer.limit(ByteBuffer.java:820)
                                                                                   at com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioDecoder.decode(FfmpegAudioDecoder.java:139)
                                                                                   at com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioDecoder.decode(FfmpegAudioDecoder.java:32)
                                                                                   at com.google.android.exoplayer2.decoder.SimpleDecoder.decode(SimpleDecoder.java:241)
                                                                                   at com.google.android.exoplayer2.decoder.SimpleDecoder.run(SimpleDecoder.java:202) 
                                                                                   at com.google.android.exoplayer2.decoder.SimpleDecoder.access$000(SimpleDecoder.java:29) 
                                                                                   at com.google.android.exoplayer2.decoder.SimpleDecoder$1.run(SimpleDecoder.java:73) 

Media

Send by mail.

Bug Report

@Tolriq
Copy link
Contributor Author

Tolriq commented Nov 8, 2022

Doing some tests ffmpeg returns -1094995529 -> AVERROR_INVALIDDATA

If would be nice if the library detected those negative values and at least throw a better error message.

Now about the root issue, since those files does not give errors via other decoders would is make sense to handle invalid data at the end of the file and ignore it like some cases handled for mp3 ?

@rohitjoins rohitjoins self-assigned this Nov 8, 2022
@Tolriq
Copy link
Contributor Author

Tolriq commented Nov 8, 2022

@Tolriq
Copy link
Contributor Author

Tolriq commented Nov 8, 2022

Fix confirmed made a PR

#10762

@rohitjoins
Copy link
Contributor

@Tolriq Thank you for sending the PR. I agree with the fix in the error message and will accept the PR soon. Overriding behaviour of ffmpeg to handle invalid data seems tricky and hard to maintain in the future. I believe we should mirror the ffmpeg extension when enabled.

@Tolriq
Copy link
Contributor Author

Tolriq commented Nov 8, 2022

@rohitjoins actually there's nothing more to do, the fix does return the proper code that is supported by the decoder and in the case of that file properly ignore the invalid data at the end of it.

So simple fix to greatly improve resilience of the ffmpeg extension.

microkatz pushed a commit to androidx/media that referenced this issue Nov 10, 2022
… invalid result codes

Imported from GitHub PR Issue: google/ExoPlayer#10762

This ensure that ffmpeg error code are properly translated to values that the ExoPlayer decoder understand.
The main gain is that it allows the decoder to properly ignore more cases of invalid data and recover.
The second gain is that the other errors are now proper ExoPlayer errors and no more obscure buffer ones.

Fixes: Issue: google/ExoPlayer#10760
Merge 82ceeb77d6df71f5ffb0474db66a36fd6eb8e51a into 972e169
COPYBARA_INTEGRATE_REVIEW=go/exoghi/10762 from Tolriq:ffmpeg_error_code 82ceeb77d6df71f5ffb0474db66a36fd6eb8e51a
PiperOrigin-RevId: 487189910
microkatz pushed a commit that referenced this issue Nov 10, 2022
…codes

Imported from GitHub PR Issue: #10762

This ensure that ffmpeg error code are properly translated to values that the ExoPlayer decoder understand.
The main gain is that it allows the decoder to properly ignore more cases of invalid data and recover.
The second gain is that the other errors are now proper ExoPlayer errors and no more obscure buffer ones.

Fixes: Issue: #10760
Merge 82ceeb7 into 972e169
COPYBARA_INTEGRATE_REVIEW=go/exoghi/10762 from Tolriq:ffmpeg_error_code 82ceeb7
PiperOrigin-RevId: 487189910
microkatz pushed a commit to androidx/media that referenced this issue Nov 22, 2022
… invalid result codes

Imported from GitHub PR Issue: google/ExoPlayer#10762

This ensure that ffmpeg error code are properly translated to values that the ExoPlayer decoder understand.
The main gain is that it allows the decoder to properly ignore more cases of invalid data and recover.
The second gain is that the other errors are now proper ExoPlayer errors and no more obscure buffer ones.

Fixes: Issue: google/ExoPlayer#10760
Merge 82ceeb77d6df71f5ffb0474db66a36fd6eb8e51a into 972e169
COPYBARA_INTEGRATE_REVIEW=go/exoghi/10762 from Tolriq:ffmpeg_error_code 82ceeb77d6df71f5ffb0474db66a36fd6eb8e51a
PiperOrigin-RevId: 487189910

(cherry picked from commit a1c04cd)
microkatz pushed a commit that referenced this issue Nov 22, 2022
…codes

Imported from GitHub PR Issue: #10762

This ensure that ffmpeg error code are properly translated to values that the ExoPlayer decoder understand.
The main gain is that it allows the decoder to properly ignore more cases of invalid data and recover.
The second gain is that the other errors are now proper ExoPlayer errors and no more obscure buffer ones.

Fixes: Issue: #10760
Merge 82ceeb7 into 972e169
COPYBARA_INTEGRATE_REVIEW=go/exoghi/10762 from Tolriq:ffmpeg_error_code 82ceeb7
PiperOrigin-RevId: 487189910

(cherry picked from commit 6d2e7a1)
@google google locked and limited conversation to collaborators Jan 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants