androidx / androidx/media

Video-only tunneling on codec2 devices

Open
#2,541 9 comments 0 reactions 1 assignee View on GitHub

@microkatz is already working on this.

Since Jun 20, 2025.

enhancement
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description


Replace the content in the sections below.

[REQUIRED] Use case description

The exoplayer library even in its latest version seems to assume that audio is required to enable video-tunneling. The codec2 framework allows video-only tunneling as it has introduced the sync-mode REALTIME as the fallback mode when neither of the parameters audio-hw-sync or hw-av-sync-id are present. In REALTIME sync-mode, the video codec2 component is expected to play video using the system clock to synchronize instead of waiting for audio to perform a/v sync.

Here's a link to the Android documentation where this is described:
https://source.android.com/docs/devices/tv/multimedia-tunneling#codec2

There are two sections of the exoplayer library where the audio-presence restriction is enforced.

  1. Tunneled codec selection.
    The DefaultTrackSelector of the exoplayer library won't select a tunneled decoder unless the audio renderer is valid.
    https://github.com/androidx/media/blob/release/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/DefaultTrackSelector.java#L3198

  2. Audio session id
    The audio session id is set to the MediaCodecVideoRenderer whether there is a valid audio track or not. Setting the audio session id results in MediaCodec setting the parameter "audio-hw-sync" when configuring the codec. This results in the codec2 component expecting audio to be present.

https://github.com/androidx/media/blob/release/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/ExoPlayerImpl.java#L2898

Proposed solution

Removing restriction 1) is fairly straightforward. We have experimented with it successfully already.

Restriction 2) seems more difficult (at least for us, who aren't experts on exoplayer library). I suppose setting the session id needs to be delayed until the audio track is found but we're not sure what's the best way to code that.

Alternatives considered

We don't have an alternative at this point. We have restricted our customers to only use video-tunneling with audio, but there are some cases where that is not practical.

We are happy to test potential solutions to this problem if that helps expedite the development.

Thanks,
Luis

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.