cast-tv: log the audio decoder it advertises, like the video half
- Commit
8c1bc5929b7b1e53070fa422f2e8c1f49ea934aa- Author
- vayun-mathur <[email protected]>
- When
- 2026-08-23 18:51 UTC (3 months ago)
- Parents
ab9b4e7
Diff
cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/AudioPlayer.kt
diff --git a/cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/AudioPlayer.kt b/cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/AudioPlayer.ktindex 3b41f319bf..380f97a79a 100644--- a/cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/AudioPlayer.kt+++ b/cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/AudioPlayer.kt@@ -293,8 +293,19 @@ class AudioPlayer { * possible nobody asked - a TV with no Opus decoder just played a silent picture - so an * audio-only session would have sat in silence with no failure to report. */- fun limits(): List<AudioCodec> =- if (decoderName() != null) listOf(AudioCodec.Opus) else emptyList()+ fun limits(): List<AudioCodec> {+ val name = decoderName()+ if (name == null) {+ Log.i(TAG, "no $AUDIO_MIME decoder on this TV; audio-only sessions will be refused")+ return emptyList()+ }+ // Logged for the same reason `VideoDecoder.limits` logs its codecs: which decoder was+ // found, and whether one was found at all, can only be answered on hardware and only+ // from this line. A silent audio half was how an unplayable session used to look+ // identical to a working one.+ Log.i(TAG, "advertising ${AudioCodec.Opus.label} decode from $name")+ return listOf(AudioCodec.Opus)+ } fun decoderName(): String? { val codecs = MediaCodecList(MediaCodecList.REGULAR_CODECS).codecInfos
cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/ReceiverAdvertiser.kt
diff --git a/cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/ReceiverAdvertiser.kt b/cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/ReceiverAdvertiser.ktindex 84b3c6bbb1..93f17d2b37 100644--- a/cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/ReceiverAdvertiser.kt+++ b/cast/tv/src/main/java/com/vayunmathur/cast/tv/platform/ReceiverAdvertiser.kt@@ -124,7 +124,8 @@ class ReceiverAdvertiser(context: Context) { Log.i( TAG, "advertised $MACAST_SERVICE_TYPE as ${info.serviceName} on port $port " +- "(decoding ${limits.codecs.joinToString { it.label }.ifEmpty { "nothing" }})",+ "(decoding ${(limits.codecs.map { it.label } + limits.audioCodecs.map { it.label })+ .joinToString().ifEmpty { "nothing" }})", ) }