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

Playback does not start for a specific MPEG/TS stream #1971

Open
goffioul opened this issue Dec 13, 2024 · 2 comments
Open

Playback does not start for a specific MPEG/TS stream #1971

goffioul opened this issue Dec 13, 2024 · 2 comments

Comments

@goffioul
Copy link
Contributor

goffioul commented Dec 13, 2024

I'm running the androidx-media3 demo app (from 1.5.0 release) on an Android device and I've encountered an issue with a specific MPEG/TS stream whereby the playback doesn't start. In the logs, I see a repetition of

12-12 20:54:38.518  5656  5690 W DefaultLoadControl: Target buffer size reached with less than 500ms of buffered media data.

and the playback eventually fails with

12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal: Playback error
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:   androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:721)
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:       at android.os.Handler.dispatchMessage(Handler.java:102)
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:       at android.os.Looper.loopOnce(Looper.java:201)
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:       at android.os.Looper.loop(Looper.java:288)
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:       at android.os.HandlerThread.run(HandlerThread.java:67)
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:   Caused by: java.lang.IllegalStateException: Playback stuck buffering and not loading
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1224)
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:562)
12-12 20:54:38.532  5656  5690 E ExoPlayerImplInternal:       ... 4 more

A stream sample will be shared via email. This is normally a live TV stream broadcasted with UDP/multicast. For testing purpose, I'm streaming the .ts sample via HTTPS and play it with:

adb shell am start -a androidx.media3.demo.main.action.VIEW -d https://...

I understand that the stream is not clean (quite the opposite), but I'm looking for options in order to handle the case more gracefully than playback failure (and the TV/hardware provider claims everything is ok as VLC can play the channel fine...). I've already tried to tweak various buffering-related constants in the code to work around the issue, but have been unsuccessful so far. I'm not sure the root cause is a buffer-limit issue.

Any assistance or pointers would be greatly appreciated.

@goffioul
Copy link
Contributor Author

After further debugging, I found out a possible explanation: the PMT table declares 2 AC3 tracks, but there's data in only one of them. This results in Ac3Reader never calling SampleQueue.format(), leaving one of the sample queue without a format. And ProgressiveMediaPeriod.maybeFinishPrepare() is never executed (exits early due to initial checks).

Not sure what's the best approach here. One can of course blame the stream, but as I said, this is coming from a live TV provider, one don't really have control on its content. On the other hand, I'm not sure there's something that can easily be done in androidx-media code base.

@rohitjoins rohitjoins self-assigned this Dec 13, 2024
@steelbytes
Copy link

I'm getting this error trying to stream preview from my gopro10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants