mirror of
https://github.com/androidx/media.git
synced 2025-05-10 00:59:51 +08:00
Notify listeners when audio session ID is set
PiperOrigin-RevId: 301187369
This commit is contained in:
parent
354d5aea09
commit
aec6fe7e65
@ -698,6 +698,9 @@ public class SimpleExoPlayer extends BasePlayer
|
||||
@Override
|
||||
public void setAudioSessionId(int audioSessionId) {
|
||||
verifyApplicationThread();
|
||||
if (this.audioSessionId == audioSessionId) {
|
||||
return;
|
||||
}
|
||||
this.audioSessionId = audioSessionId;
|
||||
for (Renderer renderer : renderers) {
|
||||
if (renderer.getTrackType() == C.TRACK_TYPE_AUDIO) {
|
||||
@ -708,6 +711,9 @@ public class SimpleExoPlayer extends BasePlayer
|
||||
.send();
|
||||
}
|
||||
}
|
||||
if (audioSessionId != C.AUDIO_SESSION_ID_UNSET) {
|
||||
notifyAudioSessionIdSet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1816,6 +1822,19 @@ public class SimpleExoPlayer extends BasePlayer
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyAudioSessionIdSet() {
|
||||
for (AudioListener audioListener : audioListeners) {
|
||||
// Prevent duplicate notification if a listener is both a AudioRendererEventListener and
|
||||
// a AudioListener, as they have the same method signature.
|
||||
if (!audioDebugListeners.contains(audioListener)) {
|
||||
audioListener.onAudioSessionId(audioSessionId);
|
||||
}
|
||||
}
|
||||
for (AudioRendererEventListener audioDebugListener : audioDebugListeners) {
|
||||
audioDebugListener.onAudioSessionId(audioSessionId);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("SuspiciousMethodCalls")
|
||||
private void notifySkipSilenceEnabledChanged() {
|
||||
for (AudioListener listener : audioListeners) {
|
||||
@ -1986,16 +2005,7 @@ public class SimpleExoPlayer extends BasePlayer
|
||||
return;
|
||||
}
|
||||
audioSessionId = sessionId;
|
||||
for (AudioListener audioListener : audioListeners) {
|
||||
// Prevent duplicate notification if a listener is both a AudioRendererEventListener and
|
||||
// a AudioListener, as they have the same method signature.
|
||||
if (!audioDebugListeners.contains(audioListener)) {
|
||||
audioListener.onAudioSessionId(sessionId);
|
||||
}
|
||||
}
|
||||
for (AudioRendererEventListener audioDebugListener : audioDebugListeners) {
|
||||
audioDebugListener.onAudioSessionId(sessionId);
|
||||
}
|
||||
notifyAudioSessionIdSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user