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

Opus File no longer plays #7046

Closed
PaulWoitaschek opened this issue Mar 5, 2020 · 6 comments
Closed

Opus File no longer plays #7046

PaulWoitaschek opened this issue Mar 5, 2020 · 6 comments
Assignees
Labels

Comments

@PaulWoitaschek
Copy link

With 2.11.3 opus files that played before don't play any longer.

The issue was originally reported here:
PaulWoitaschek/Voice#948

The issue contains an example file.
When trying to play it, the following error happens:

2020-03-05 06:44:39.395 13664-13728/? E/opus_jni: Failed to set Opus header gain; status=invalid argument
2020-03-05 06:44:39.395 13664-13728/? E/ExoPlayerImplInternal: Renderer error: index=0, type=audio, format=Format(null, null, null, audio/opus, null, -1, null, [-1, -1, -1.0], [2, 48000]), rendererSupport=YES
    com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.ext.opus.OpusDecoderException: Failed to initialize decoder
        at com.google.android.exoplayer2.BaseRenderer.createRendererException(BaseRenderer.java:359)
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.maybeInitDecoder(SimpleDecoderAudioRenderer.java:655)
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.onInputFormatChanged(SimpleDecoderAudioRenderer.java:701)
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.render(SimpleDecoderAudioRenderer.java:280)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:599)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:329)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loop(Looper.java:214)
        at android.os.HandlerThread.run(HandlerThread.java:67)
     Caused by: com.google.android.exoplayer2.ext.opus.OpusDecoderException: Failed to initialize decoder
        at com.google.android.exoplayer2.ext.opus.OpusDecoder.<init>(OpusDecoder.java:134)
        at com.google.android.exoplayer2.ext.opus.LibopusAudioRenderer.createDecoder(LibopusAudioRenderer.java:111)
        at com.google.android.exoplayer2.ext.opus.LibopusAudioRenderer.createDecoder(LibopusAudioRenderer.java:31)
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.maybeInitDecoder(SimpleDecoderAudioRenderer.java:648)
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.onInputFormatChanged(SimpleDecoderAudioRenderer.java:701) 
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.render(SimpleDecoderAudioRenderer.java:280) 
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:599) 
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:329) 
        at android.os.Handler.dispatchMessage(Handler.java:103) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.os.HandlerThread.run(HandlerThread.java:67) 
@krocard
Copy link
Contributor

krocard commented Mar 11, 2020

I can not reproduce the failure on :

git checkout r2.11.3
./gradlew demo:installNoExtensionsDebug
adb push ok.opus not_ok.opus /sdcard/
adb shell am start -a com.google.android.exoplayer.demo.action.VIEW     -d file:/sdcard/ok.opus
adb shell am start -a com.google.android.exoplayer.demo.action.VIEW     -d file:/sdcard/not_ok.opus

Both playback played without error on both my device (Pixel 3 and Nvidia shield).

@krocard
Copy link
Contributor

krocard commented Mar 11, 2020

Actually, from the log, the Opus extension seems to be used: https://github.com/google/ExoPlayer/blob/r2.11.3/extensions/opus/src/main/jni/opus_jni.cc#L82

@PaulWoitaschek
Copy link
Author

That's opus 1.3.1.
This is the repo for opus:

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    implementation "com.github.PaulWoitaschek.ExoPlayer-Extensions:extension-opus:2.11.3" {
        transitive = false
    }
}

The library is set to EXTENSION_RENDERER_MODE_PREFER.

https://github.com/PaulWoitaschek/Voice/blob/97f06a38834fc55fec39379b4a5545851527d632/app/src/main/java/de/ph1b/audiobook/playback/OnlyAudioRenderersFactory.kt#L23

@krocard
Copy link
Contributor

krocard commented Mar 11, 2020

Thanks for your opus version, I'll try again with the extension this time.

@ojw28
Copy link
Contributor

ojw28 commented Mar 27, 2020

It looks like we parse gain as an unsigned value, when it should be interpreted as a signed value. It's not a regression though; the problem has been there ever since the OpusDecoder was first written in 2016.

ojw28 added a commit that referenced this issue Mar 27, 2020
Issue: #7046
PiperOrigin-RevId: 303354941
@ojw28
Copy link
Contributor

ojw28 commented Mar 27, 2020

Fixed in dev-v2.

@ojw28 ojw28 closed this as completed Mar 27, 2020
ojw28 added a commit that referenced this issue Mar 30, 2020
Issue: #7046
PiperOrigin-RevId: 303354941
@google google locked and limited conversation to collaborators May 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants