mirror of
https://github.com/androidx/media.git
synced 2025-04-29 22:36:54 +08:00
Add more details to thread assertion in onAudioCapabilitiesChanged
This helps to debug issues reported in https://github.com/androidx/media/issues/1191 PiperOrigin-RevId: 636545970
This commit is contained in:
parent
f5438c9d55
commit
7b352e1903
@ -1530,7 +1530,18 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
// AudioCapabilitiesReceiver.Listener implementation.
|
||||
|
||||
public void onAudioCapabilitiesChanged(AudioCapabilities audioCapabilities) {
|
||||
checkState(playbackLooper == Looper.myLooper());
|
||||
Looper myLooper = Looper.myLooper();
|
||||
if (playbackLooper != myLooper) {
|
||||
String playbackLooperName =
|
||||
playbackLooper == null ? "null" : playbackLooper.getThread().getName();
|
||||
String myLooperName = myLooper == null ? "null" : myLooper.getThread().getName();
|
||||
throw new IllegalStateException(
|
||||
"Current looper ("
|
||||
+ myLooperName
|
||||
+ ") is not the playback looper ("
|
||||
+ playbackLooperName
|
||||
+ ")");
|
||||
}
|
||||
if (!audioCapabilities.equals(this.audioCapabilities)) {
|
||||
this.audioCapabilities = audioCapabilities;
|
||||
if (listener != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user