Open cedricxperi opened 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!
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.
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:
If checking format.sampleMimeType.equals(MimeTypes.AUDIO_DTS_X)
, there is a possiblity that encoding
is already a C.ENCODING_DTS
due to the TV doesn't support DTS:X. Is such TV still in a category of DTS:X TV and has the misreporting issue? Also in such case, the theoretical max channel count supported for C.ENCODING_DTS
is 6 anyway, so a misreporting from 10 to 8 won't block the playback of it.
If checking encoding == C.ENCODING_DTS_UHD_P2
, at this point we're sure that the TV supports DTS:X, so in case the max channel count is misreported as 8 instead of 10, we do the above workaround - which sounds more accurate?
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!
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
If checking format.sampleMimeType.equals(MimeTypes.AUDIO_DTS_X), there is a possiblity that encoding is already a C.ENCODING_DTS due to the TV doesn't support DTS:X? Is such TV still in a category of DTS:X TV and has the misreporting issue? Also in such case, the theoretical max channel count supported for C.ENCODING_DTS is 6 anyway, so a misreporting from 10 to 8 won't block the playback of it.
If checking encoding == C.ENCODING_DTS_UHD_P2, at this point we're sure that the TV supports DTS:X, so in case the max channel count is misreported as 8 instead of 10, we do the above workaround - which sounds more accurate?
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.
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;
}
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: @.***>
Cool, thank you!
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: @.***>
Sounds good, thanks for your help! Yes, I will be helping to make the contribution change.
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: @.***>
@tianyif Hi, I checked the logic again and here are my views:
When playing back a DTSX stream, we currently remap the encoding to ENCODING_DTS because we have been advised by MTK to do so (for Direct passthrough playback). The remapping is required because ENCODING_DTS_UHD_P2 is only defined from API 34 onwards. Right now, supported encodings does not return ENCODING_DTS_UHD_P2 even if the MTK platform actually supports dtsx decoding.
You mentioned, "If checking encoding == C.ENCODING_DTS_UHD_P2, at this point we're sure that the TV supports DTS:X". Actually I think we are not sure at this point if the TV supports DTSX because encoding was set to C.ENCODING_DTS_UHD_P2 in Mimetypes.java. It is just a mapping of mimetype to encoding which does not tell us what the system supports?
Also, for dtsx playback, encoding would have been remapped to ENCODING_DTS and not ENCODING_DTS_UHD_P2. So "encoding == C.ENCODING_DTS_UHD_P2" will return false for DTSX playback and the "channel count > 10" check will not take place. The playback will then stop if maxChannelCount is reported by the platform as 8 instead of 10.
-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.
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 :)
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
Get the code from this commit 03914340bdb0887e3243c74301757df6e995af19 from pull request
Add https://secured.streamdts.com/dtsx/dtsx/dash/callout/index.mpd to media.exolist.json
Comment out the following around line 231 of Audiocapabilities.java / if (format.sampleMimeType == MimeTypes.AUDIO_DTS_X) { if (channelCount > 10) { return null; } } else /
Connect Xiaomi V435H to a Audio Video Receiver
Enable tunnel mode in Exoplayer
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
adb bugreport
to dev.exoplayer@gmail.com after filing this issue.