Closed AlienAsRoger closed 3 years ago
Thanks for reporting this, and for the detailed reproduction steps. Please do take care to include all of the requested information when filing future issues though! In this particular instance, including a bug report (or even logcat output) would have shown the root cause, which is unrelated to ads:
EventLogger: com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
EventLogger: at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:595)
EventLogger: at android.os.Handler.dispatchMessage(Handler.java:102)
EventLogger: at android.os.Looper.loop(Looper.java:246)
EventLogger: at android.os.HandlerThread.run(HandlerThread.java:67)
EventLogger: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.nio.ByteBuffer java.nio.ByteBuffer.order(java.nio.ByteOrder)' on a null object reference
EventLogger: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.bypassRender(MediaCodecRenderer.java:2199)
EventLogger: at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:801)
EventLogger: at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:953)
EventLogger: at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:482)
EventLogger: ... 3 more
EventLogger: ]
This will be fixed shortly, and be eligible for the next minor release (although we don't have an ETA).
As you've noticed, passing a sufficiently large value as the durationUs
argument when creating your SilenceMediaSource
is a valid workaround. You should use the smallest value that fixes the issue, to avoid delaying the player transitioning to the ended state. The smallest value that fixes the issue is 23.
Thank you so much for such a quick response @ojw28 !
For further requests I'll include more logs from EventLogger
as well.
I'm getting a similar stacktrace as well when trying to play these files through the ExoPlayer demo app:
https://temp-audio-bucket-1.s3.ap-south-1.amazonaws.com/Recording+1.wav
https://temp-audio-bucket-1.s3.ap-south-1.amazonaws.com/Recording+76.wav
media.exolist.json
:
...
{
"name": "User uploaded",
"samples": [
{
"name": "Recording 80 - working",
"uri": "https://temp-audio-bucket-1.s3.ap-south-1.amazonaws.com/Recording+80.wav"
},
{
"name": "Recording 1 - not working",
"uri": "https://temp-audio-bucket-1.s3.ap-south-1.amazonaws.com/Recording+1.wav"
},
{
"name": "Recording 76 - not working",
"uri": "https://temp-audio-bucket-1.s3.ap-south-1.amazonaws.com/Recording+76.wav"
}
]
}
...
For reference, I've got the same files working as expected when streaming them through the VLC Android app. (https://play.google.com/store/apps/details?id=org.videolan.vlc&hl=en_IN&gl=US)
Stacktrace:
2020-12-22 19:06:29.332 21782-25610/com.google.android.exoplayer2.demo E/ExoPlayerImplInternal: Playback error
com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:564)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:246)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.nio.ByteBuffer java.nio.ByteBuffer.order(java.nio.ByteOrder)' on a null object reference
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.bypassRender(MediaCodecRenderer.java:2206)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:852)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:892)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:467)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:246)
at android.os.HandlerThread.run(HandlerThread.java:67)
2020-12-22 19:06:29.337 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: audioDisabled [eventTime=1.22, mediaPos=0.00, window=0, period=0]
2020-12-22 19:06:29.338 21782-21782/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [eventTime=1.23, mediaPos=0.00, window=0, period=0
com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:564)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:246)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.nio.ByteBuffer java.nio.ByteBuffer.order(java.nio.ByteOrder)' on a null object reference
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.bypassRender(MediaCodecRenderer.java:2206)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:852)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:892)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:467)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:246)
at android.os.HandlerThread.run(HandlerThread.java:67)
]
EventLogger events before the above stacktrace popped up:
2020-12-22 19:06:29.308 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: seekStarted [eventTime=1.19, mediaPos=0.01, window=0, period=0]
2020-12-22 19:06:29.308 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: positionDiscontinuity [eventTime=1.20, mediaPos=0.00, window=0, period=0, SEEK]
2020-12-22 19:06:29.312 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: state [eventTime=1.20, mediaPos=0.00, window=0, period=0, BUFFERING]
2020-12-22 19:06:29.315 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: positionDiscontinuity [eventTime=1.20, mediaPos=0.00, window=0, period=0, SEEK_ADJUSTMENT]
2020-12-22 19:06:29.317 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: loading [eventTime=1.20, mediaPos=0.00, window=0, period=0, true]
2020-12-22 19:06:29.320 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=1.21, mediaPos=0.00, window=0, period=0, id=null, mimeType=audio/raw, bitrate=705600, channels=1, sample_rate=44100]
2020-12-22 19:06:29.321 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: loading [eventTime=1.21, mediaPos=0.00, window=0, period=0, false]
2020-12-22 19:06:29.321 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: state [eventTime=1.21, mediaPos=0.00, window=0, period=0, READY]
2020-12-22 19:06:29.324 21782-21782/com.google.android.exoplayer2.demo D/EventLogger: isPlaying [eventTime=1.21, mediaPos=0.00, window=0, period=0, true]
In our code we had this part
which was working fine with ExoPlayer version 2.11.8
In order to launch standalone IMA preroll and then when it finishes launch another player which might not be ExoPlayer. So we relied on correct callback which is called
Steps to reproduce
media.exolist.json
onPlayerError() called with: error = [com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error]
" andImaAdsLoader
receives PAUSE callback instead of COMPLETEDUPDATE:
Passing
new SilenceMediaSource(TimeUnit.SECONDS.toMicros(1))
solves the problem.Proposed solution:
throw an error if duration of
SilenceMediaSource
isn't enough for player to actually play it.