Skip to content

Commit

Permalink
Add method to check if tunneling is enabled.
Browse files Browse the repository at this point in the history
Issue: google/ExoPlayer#2518
PiperOrigin-RevId: 460482615
  • Loading branch information
tonihei authored and rohitjoins committed Jul 13, 2022
1 parent 6922bd5 commit 549496f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Expand Up @@ -9,6 +9,9 @@
([#9889](https://github.com/google/ExoPlayer/issues/9889)).
* For progressive media, only include selected tracks in buffered position
([#10361](https://github.com/google/ExoPlayer/issues/10361)).
* Add `ExoPlayer.isTunnelingEnabled` to check if tunneling is enabled for
the currently selected tracks
([#2518](https://github.com/google/ExoPlayer/issues/2518)).
* Extractors:
* Add support for AVI
([#2092](https://github.com/google/ExoPlayer/issues/2092)).
Expand Down
Expand Up @@ -1696,4 +1696,14 @@ void setVideoChangeFrameRateStrategy(
*/
@UnstableApi
boolean experimentalIsSleepingForOffload();

/**
* Returns whether <a
* href="https://source.android.com/devices/tv/multimedia-tunneling">tunneling</a> is enabled for
* the currently selected tracks.
*
* @see Player.Listener#onTracksChanged(Tracks)
*/
@UnstableApi
boolean isTunnelingEnabled();
}
Expand Up @@ -1682,6 +1682,17 @@ public void setDeviceMuted(boolean muted) {
streamVolumeManager.setMuted(muted);
}

@Override
public boolean isTunnelingEnabled() {
verifyApplicationThread();
for (RendererConfiguration config : playbackInfo.trackSelectorResult.rendererConfigurations) {
if (config.tunneling) {
return true;
}
}
return false;
}

/* package */ void setThrowsWhenUsingWrongThread(boolean throwsWhenUsingWrongThread) {
this.throwsWhenUsingWrongThread = throwsWhenUsingWrongThread;
}
Expand Down
Expand Up @@ -1258,6 +1258,12 @@ public void setDeviceMuted(boolean muted) {
player.setDeviceMuted(muted);
}

@Override
public boolean isTunnelingEnabled() {
blockUntilConstructorFinished();
return player.isTunnelingEnabled();
}

/* package */ void setThrowsWhenUsingWrongThread(boolean throwsWhenUsingWrongThread) {
blockUntilConstructorFinished();
player.setThrowsWhenUsingWrongThread(throwsWhenUsingWrongThread);
Expand Down
Expand Up @@ -412,4 +412,9 @@ public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEna
public boolean experimentalIsSleepingForOffload() {
throw new UnsupportedOperationException();
}

@Override
public boolean isTunnelingEnabled() {
throw new UnsupportedOperationException();
}
}

0 comments on commit 549496f

Please sign in to comment.