Fix ProgressiveMediaPeriod hang#3235
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Because I have been using the earlier PR with my own diff for sometime I asked Claude to create an analysis why this change is needed below since it doesn't think it is a TSExtractor problem PR Case: Fix ProgressiveMediaPeriod hanging when MPEG-TS PMT declares a track that carries no PES dataProblem StatementWhen an MPEG-TS file declares an elementary stream in the PMT (Program Map Table) but that This is a real-world problem with recordings from DVB-T2 and ATSC broadcasts. The file Evidence:
|
Fix ProgressiveMediaPeriod hang when MPEG-TS PMT declares a track that carries no PES data
When an MPEG-TS file declares an elementary stream in the PMT but that stream carries zero PES packets (e.g. a "visual impaired commentary" audio service that is listed in the PMT but not actually broadcast), ProgressiveMediaPeriod.maybeFinishPrepare() loops returning early indefinitely because sampleQueue.getUpstreamFormat() == null for that queue. The player times out with StuckPlayerException: Player
stuck buffering and not loading after 4 seconds. This is a real-world problem with DVB-T2 and ATSC recordings.
This was previously reported as ExoPlayer#7873 and addressed by ExoPlayer PR#8063 (closed without merge). The bug is unchanged in media3 1.10.1.
Fix (single file: ProgressiveMediaPeriod.java):
still loading, wait. In cases (a) and (b), assign an empty Format.Builder().build() placeholder so preparation can complete on the tracks that do carry data.
The placeholder has a null sampleMimeType, which DefaultTrackSelector leaves unselected and which trackIsAudioVideoFlags marks false (excluded from buffering calculations). No renderer claims it. The happy path (all queues have formats) is unchanged — maybeFinishPrepare() returns immediately at the prepared guard on any extra invocation.