androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.7k stars 406 forks source link

DTS:X TV reporting ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8 instead of 10 #396

Open cedricxperi opened 1 year ago

cedricxperi commented 1 year ago

Media3 Version

Media3 1.0.1

Devices that reproduce the issue

Xiaomi TV V435H

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

  1. Get the code from this commit 03914340bdb0887e3243c74301757df6e995af19 from pull request

  2. Add https://secured.streamdts.com/dtsx/dtsx/dash/callout/index.mpd to media.exolist.json

  3. Comment out the following around line 231 of Audiocapabilities.java / if (format.sampleMimeType == MimeTypes.AUDIO_DTS_X) { if (channelCount > 10) { return null; } } else /

  4. Connect Xiaomi V435H to a Audio Video Receiver

  5. Enable tunnel mode in Exoplayer

  6. Playback the following DASH stream https://secured.streamdts.com/dtsx/dtsx/dash/callout/index.mpd

Expected result

Media should playback properly.

Actual result

Playback will fail at maxChannelCount check in AudioCapabilities.getEncodingAndChannelConfigForPassthrough(). Because the number of channels encoded in the stream is 10, while the TV (through ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT) reported that the connected audio sink only supports up to 8 channels. The TV is actually capable of playing back the stream but is blocked by this check on Exoplayer side.

NOTE: This issue is related to the following pull request: https://github.com/androidx/media/pull/335 A temporary fix has been added in this pull request which has not been merged. As it is a device issue, once the device reports the maxChannelCount correctly, we can remove the fix in AudioCapabilities.getEncodingAndChannelConfigForPassthrough(). cc @tianyif

Media

https://secured.streamdts.com/dtsx/dtsx/dash/callout/index.mpd

Bug Report

tianyif commented 1 year ago

Hi @cedricxperi,

Could you please send us a bug report of this issue. Mis-reporting of ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT can be a platform or device issue, we need to figure it out. Thanks!

cedricxperi commented 1 year ago

Logcat_tunnel_mode_enabled_dtsx51.4._playback.txt @tianyif Attached is logcat from attempting to play back a DTS:X 5.1.4 DASH stream via direct passthrough by enabling tunnel mode.

Thanks.

tianyif commented 10 months ago

Hi @cedricxperi,

Sorry for touching on this old issue again! I hope to double check with you on this issue when I revisited these lines.

Because before the above lines, we have such mutation on the encoding that if the output device doesn't support C.ENCODING_DTS_UHD_P2 but support C.ENCODING_DTS, the encoding will be reduced to C.ENCODING_DTS.

And here in the linked lines, we are checking the format.sampleMimeType.equals(MimeTypes.AUDIO_DTS_X) instead of the encoding encoding == C.ENCODING_DTS_UHD_P2. I'm wondering which one is more accurate. As:

I saw there are some discussions among us in the pull request https://github.com/androidx/media/pull/335 around these line, but I didn't find the details to address my question, so asking it here.

Looking forward to your insights!

cedricxperi commented 10 months ago

Hi Tianyi,

Thanks.

So what you are saying is that

* Playing back a dtsx stream on a Non-DTS:X TV will not be stopped because we remapped the encoding to ENCODING_DTS? I think that is possible.

And your suggestion is to add a layer of checking encoding == C.ENCODING_DTS_UHD_P2 like below to solve the issue?

} else { channelCount = format.channelCount; // Some DTS:X TVs reports ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8 // instead of 10. See https://github.com/androidx/media/issues/396  if (encoding == C.ENCODING_DTS_UHD_P2)   {            if (format.sampleMimeType.equals(MimeTypes.AUDIO_DTS_X)) {     if (channelCount > 10) {   return null;     }       }

  } else if (channelCount > maxChannelCount) {
    return null;
  }

It sounds good but I will need to check if there are any side effects to the above.

Thanks.

Regards,

Cedric Tio


From: Tianyi Feng @.> Sent: Thursday, January 11, 2024 3:49 PM To: androidx/media @.> Cc: Cedric Tio @.>; Mention @.> Subject: Re: [androidx/media] DTS:X TV reporting ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8 instead of 10 (Issue #396)

Hi @cedricxperihttps://github.com/cedricxperi,

Sorry for touching on this old issue again! I hope to double check with you on this issue when I revisited these [lines] (https://github.com/androidx/media/blob/release/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/AudioCapabilities.java#L237-L242).

Because before the above lines, we have such mutation on the encoding that if the output device doesn't support C.ENCODING_DTS_UHD_P2 but support C.ENCODING_DTS, the encoding will be reduced to C.ENCODING_DTS.

And here in these lines, we are checking the format.sampleMimeType.equals(MimeTypes.AUDIO_DTS_X) instead of the encoding encoding == C.ENCODING_DTS_UHD_P2. I'm wondering which one is more accurate. As

I saw there are some discussions among us in the pull request #335https://github.com/androidx/media/pull/335 around these line, but I didn't find the details to address my question, so asking it here.

Looking forward to your insights!

— Reply to this email directly, view it on GitHubhttps://github.com/androidx/media/issues/396#issuecomment-1886530282, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVT4CXJQCL4SGYSDHDXQFIDYN6KPHAVCNFSM6AAAAAAYDDV5Q6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBWGUZTAMRYGI. You are receiving this because you were mentioned.

tianyif commented 10 months ago

Thanks @cedricxperi for the quick feedback!

I mean replacing the format.sampleMimeType.equals(MimeTypes.AUDIO_DTS_X) to encoding == C.ENCODING_DTS_UHD_P2, instead of adding one more layer:

else {
      channelCount = format.channelCount;
      // Some DTS:X TVs reports ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8
      // instead of 10. See [#396](https://github.com/androidx/media/issues/396)
      if (encoding == C.ENCODING_DTS_UHD_P2)) {
        if (channelCount > 10) {
            return null;
        }
      } else if (channelCount > maxChannelCount) {
        return null;
      }
cedricxperi commented 10 months ago

Hi Tianyi,

Will need to check with some streams and step through to see if all is ok if we replace mimetype check with encoding check.

Thanks.

Regards,

Cedric Tio


From: Tianyi Feng @.> Sent: Thursday, January 11, 2024 4:53 PM To: androidx/media @.> Cc: Cedric Tio @.>; Mention @.> Subject: Re: [androidx/media] DTS:X TV reporting ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8 instead of 10 (Issue #396)

Thanks @cedricxperihttps://github.com/cedricxperi for the quick feedback!

I mean replacing the format.sampleMimeType.equals(MimeTypes.AUDIO_DTS_X) to encoding == C.ENCODING_DTS_UHD_P2, instead of adding one more layer:

else { channelCount = format.channelCount; // Some DTS:X TVs reports ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8 // instead of 10. See #396   if (encoding == C.ENCODING_DTS_UHD_P2)) { if (channelCount > 10) {   return null; } } else if (channelCount > maxChannelCount) { return null; }

— Reply to this email directly, view it on GitHubhttps://github.com/androidx/media/issues/396#issuecomment-1886651858, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVT4CXIN6SDMBGB67IH5QWTYN6SCFAVCNFSM6AAAAAAYDDV5Q6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBWGY2TCOBVHA. You are receiving this because you were mentioned.Message ID: @.***>

tianyif commented 10 months ago

Cool, thank you!

cedricxperi commented 10 months ago

Hi Tianyi,

Please give me a few days to check this. Once confirmed, will you be helping to make the contribution change?

Thanks.

Regards,

Cedric Tio

E: @.


From: Tianyi Feng @.> Sent: Thursday, January 11, 2024 4:58 PM To: androidx/media @.> Cc: Cedric Tio @.>; Mention @.> Subject: Re: [androidx/media] DTS:X TV reporting ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8 instead of 10 (Issue #396)

Cool, thank you!

— Reply to this email directly, view it on GitHubhttps://github.com/androidx/media/issues/396#issuecomment-1886658703, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVT4CXKUWYCFQJICT4N723LYN6STVAVCNFSM6AAAAAAYDDV5Q6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBWGY2TQNZQGM. You are receiving this because you were mentioned.Message ID: @.***>

tianyif commented 10 months ago

Sounds good, thanks for your help! Yes, I will be helping to make the contribution change.

cedricxperi commented 10 months ago

Great! Thanks

Regards,

Cedric Tio

E: @.***


From: Tianyi Feng @.> Sent: Thursday, January 11, 2024 5:03 PM To: androidx/media @.> Cc: Cedric Tio @.>; Mention @.> Subject: Re: [androidx/media] DTS:X TV reporting ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8 instead of 10 (Issue #396)

Sounds good, thanks for your help! Yes, I will be helping to make the contribution change.

— Reply to this email directly, view it on GitHubhttps://github.com/androidx/media/issues/396#issuecomment-1886666710, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVT4CXLO2P5WLJAA6C6K57DYN6TE5AVCNFSM6AAAAAAYDDV5Q6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBWGY3DMNZRGA. You are receiving this because you were mentioned.Message ID: @.***>

cedricxperi commented 10 months ago

@tianyif Hi, I checked the logic again and here are my views:

-I think we should stick to the mimetype check? Another way I can think of is to add a flag to determine if the encoding has been remapped to ENCODING_DTS. If there is no remapping, we can check "encoding == C.ENCODING_DTS_UHD_P2", otherwise we stick to the mimetype check.

Thanks.

tianyif commented 10 months ago

Thank you @cedricxperi for the insight!

My original confusion is based on an assumption that a TV supports DTS:X will always report ENCODING_DTS_UHD_P2, without considering the remapping. So yeah, the mimetype check makes sense to me now :)