Skip to content

Audiotrack stale playback head on ac3/eac3 audio, after seeking. playback stopped. #3269

@soloish90

Description

@soloish90

Version

Media3 1.10.1

More version details

No response

Devices that reproduce the issue

Device: Hisense SmartTV 4K FFM / 65U75LUA
Android: 12, API 31
Build: STT2.230310.002 / 00.00.00.132
Security patch: 2025-05-01
SoC/platform: MediaTek MT9689 / mt5896
ABI: armeabi-v7a, armeabi only; 32-bit zygote
Display: 3840x2160 panel, Android override 1920x1080
Audio output: HDMI ARC, 48 kHz primary mixer
Media3: 1.10.1

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

Created basic Android TV application with Media 3 as player - with some logging from Media3. Play an mp4 with direct-play Dolby-style encoded audio, i think limited to AC3 and EAC3. seeking forward will likely not play, will be stuck at 'buffering', though it is not buffering. seeking generally can produce this error > 50% of the time.

Expected result

From logs:

  1. The new encoded AudioTrack may still briefly start with a stale playback head.
  2. But after play(), the playback head resets to 0.
  3. audioTrackPositionAdvancing fires.
  4. Playback continues normally.

Actual result

From the logs, the failed seek pattern looked like this:

  1. Media3 successfully seeks inside the existing source buffer.
  2. The old AC3/EAC3 AudioTrack is released/paused with a non-zero playback head.
  3. A new direct encoded AudioTrack is created, but it starts with that same stale non-zero playback head.
  4. play() is called, but the playback head does not reset.
  5. Playback then gets stuck with repeated writes returning 0, playState=2, and the playback head never advancing.

i've created a fix for my local test project, which works... though i'm not filing a PR as i doubt this is a proper fix. but it does stop the issue from happening:

https://github.com/soloish90/media/tree/ac3-eac3-audiotrack-stale-head-proof

Media

Not applicable. any media with ac3/eac3 encoded audio.

Bug Report

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions