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: #2518
PiperOrigin-RevId: 460482615
  • Loading branch information
tonihei authored and rohitjoins committed Jul 13, 2022
1 parent d6659e9 commit ab1fff4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
Expand Up @@ -1602,4 +1602,13 @@ void setVideoChangeFrameRateStrategy(
* @see AudioOffloadListener#onExperimentalSleepingForOffloadChanged(boolean)
*/
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)
*/
boolean isTunnelingEnabled();
}
Expand Up @@ -1671,6 +1671,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 @@ -1247,6 +1247,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 @@ -410,4 +410,9 @@ public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEna
public boolean experimentalIsSleepingForOffload() {
throw new UnsupportedOperationException();
}

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

0 comments on commit ab1fff4

Please sign in to comment.