question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SilenceMediaSource Error

See original GitHub issue

Hi,

I keep getting this error when trying to prepare the SilcenceMediaSource in the player, it simply fails to play.

2019-07-26 12:03:45.884 4663-5805/com.yiqqi.android.yiqqi.development E/ExoPlayerImplInternal: Internal runtime error.
    java.lang.IndexOutOfBoundsException: off=0, len=-741232 out of bounds (size=4096)
        at java.nio.Buffer.checkBounds(Buffer.java:587)
        at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:285)
        at com.google.android.exoplayer2.source.SilenceMediaSource$SilenceSampleStream.readData(SilenceMediaSource.java:219)
        at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:308)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1024)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:654)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:575)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:326)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:214)
        at android.os.HandlerThread.run(HandlerThread.java:65)

This class was created under our request and we deeply appreciate it, but it seems to have this error which makes it unusable, could you please look into it? Thank you.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shaji-Devcommented, Jul 26, 2019

Yes, here’s the situation, I have a timeline, which has multiple songs and with empty gaps between them, these gaps can be at the start and end as well. for that, I use ConcatenatingMediaSoruce with ClippingMediaSource for songs and SilenceMediaSource for gaps. Here’s a representation of a simple timeline:

-song-song-song- -: SilenceMediaSource song: ClippingMediaSource with ProgressiveMediaSource

The issue is when readData happens, the byteRemaining is a negative value which shouldn’t be the case, here’s a debug screenshot up until the hightlighted line that produces the error: image

This issue is that everytime I recreate the ConcatenatingMediaSoruce, even with the same values, with the same SilenceMediaSource durations and start positions for SilenceMediaSource and ClippingMediaSource. I sometimes get the error and sometime not. I tested with fixed constant values and recreated the ConcatenatingMediaSoruce again and again, it’s like a hit and miss, works a couple of times, then error, then works again, then error again…

I’m sorry as it’s hard to explain because I ran a couple of tests already and I can’t seem to track down the exact source of the issue.

1reaction
andrewlewiscommented, Jul 26, 2019

Could you provide some more information on how to reproduce this error? Does it occur after seeking? I just tried playing a concatenation of some media with a SilenceMediaSource in the demo app and it worked as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SilenceMediaSource (ExoPlayer library)
Returns the MediaItem whose media is provided by the source. void, maybeThrowSourceInfoRefreshError(). Throws any pending error encountered while loading or ...
Read more >
SilenceMediaSource - Android Developers
Throws any pending error encountered while loading or refreshing source information. Should not be called directly from application code.
Read more >
Source Code for SilenceMediaSource.java - AndroidX Tech
public SilenceMediaSource(long durationUs) { this(durationUs, MEDIA_ITEM); } /** * Creates a new media source providing silent audio of the given duration.
Read more >
java/PaulWoitaschek/ExoPlayer-Extensions/library/core/src ...
Learn how to use api java/PaulWoitaschek/ExoPlayer-Extensions/library/core/src/main/java/com/google/android/exoplayer2/source/SilenceMediaSource.java.
Read more >
华为移动服务/hms-wiseplay-demo-exoplayer - Gitee.com
disable to improve resource management in playlists. Add MediaPeriod.isLoading to improve Player.isLoading state. Fix issue where player errors are thrown too ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found