Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black screen on ABR changes #1158

Closed
1 task
zubcoco opened this issue Mar 7, 2024 · 10 comments
Closed
1 task

Black screen on ABR changes #1158

zubcoco opened this issue Mar 7, 2024 · 10 comments
Assignees

Comments

@zubcoco
Copy link

zubcoco commented Mar 7, 2024

Version

Media3 main branch

More version details

Issue appear with version 1.1.0 (OK with version 1.0.2)
Same on ExoPlayer, present on v2.19.0 and not with v.2.17.0

Devices that reproduce the issue

Problem is on our Box Vantiva/Technicolor (broadcom) but also reproduced on 2 differents Sony TVs.

Devices that do not reproduce the issue

Problem is not reproduced on Google TV, not on Nvidia Shield and not on Android Studio Emulator.
And also not reproduced on Samsung mobiles.

Reproducible in the demo app?

Yes

Reproduction steps

  1. In the demo app, we need to set the initial bitrate estimate to 1 MBPs (to ensure the player will change profile after a while). I use the default band width meter that we can pass to the exoplayer builder.
  2. Play the stream that I sent you by mail

Expected result

The media start with a low profile. After a while it play with the highest profile and the transition should be fluent.

Actual result

The media start with a low profile. After a while it play with the highest profile but during the transition we have a black screen.

Media

I'll send you the media to test.

Bug Report

@tonihei
Copy link
Collaborator

tonihei commented Mar 7, 2024

Since you are able to replicate the problem on your device, do you think you can search for the change that broke this behavior? I think you'd need to depend on ExoPlayer/Media3 locally (see instructions here or here, depending on which namespace you are using) and then you can move the code in a more granular way to find the problematic change.

@zubcoco
Copy link
Author

zubcoco commented Mar 8, 2024

Hello,
I've found the problematic commit: 8a73d8d.

If I compile a version and I revert all lines of this commit, the problem is solve.

Would you like me to do some special tests to help your analysis?

@zubcoco
Copy link
Author

zubcoco commented Mar 8, 2024

The problem is in NalUnitUtil class, in parseSpsNalUnitPayload function.
When I comment these lines :

      if (data.readBit()) { // overscan_info_present_flag
        data.skipBit(); // overscan_appropriate_flag
      }
      if (data.readBit()) { // video_signal_type_present_flag
        data.skipBits(3); // video_format
        colorRange =
            data.readBit() ? C.COLOR_RANGE_FULL : C.COLOR_RANGE_LIMITED; // video_full_range_flag
        if (data.readBit()) { // colour_description_present_flag
          int colorPrimaries = data.readBits(8); // colour_primaries
          int transferCharacteristics = data.readBits(8); // transfer_characteristics
          data.skipBits(8); // matrix_coeffs

          colorSpace = ColorInfo.isoColorPrimariesToColorSpace(colorPrimaries);
          colorTransfer =
              ColorInfo.isoTransferCharacteristicsToColorTransfer(transferCharacteristics);
        }
      }

the problem no longer appears.

@tonihei
Copy link
Collaborator

tonihei commented Mar 8, 2024

It's probably not that these lines itself are wrong, it's more likely that this causes some configuration change when selecting or configuring codecs for playback.

Could you attach an EventLogger and create a bugreport with and without this change and send a link to android-media-github@google.com with "Issue 1158" in the subject? Then we may be able to see what different behavior this causes exactly. If my suspicion is correct, then maybe we can add a workaround to avoid the broken configuration.

@zubcoco
Copy link
Author

zubcoco commented Mar 11, 2024

Mail sent with requested informations.
Thanks a lot.

@tonihei
Copy link
Collaborator

tonihei commented Mar 12, 2024

Thanks. Assuming you still have the local checkout, could you try to comment out all four maybeSet... calls in this method:

maybeSetInteger(format, MediaFormat.KEY_COLOR_TRANSFER, colorInfo.colorTransfer);
to see if that fixes your problem?

@zubcoco
Copy link
Author

zubcoco commented Mar 13, 2024

No, the problem is still present with these commented lines.

@tonihei
Copy link
Collaborator

tonihei commented Mar 13, 2024

Thanks for the confirmation and sharing the bugreports! I think I see the problem now and will share another fix proposal soon (sorry for constantly asking to test things out, but I don't have a reproduction setup myself).

copybara-service bot pushed a commit that referenced this issue Mar 20, 2024
Some media can read color info values from the bitstream
and may partially set some of the SDR default values in
Format.ColorInfo. Setting these default values for SDR can
confuse some codecs and may also prevent adaptive ABR
switches if not all ColorInfo values are set in exactly the
same way.

We can avoid any influence of HDR color info handling by
disabling setting the color info MediaFormat keys for SDR
video and also avoid codec reset at format changes if both
formats are SDR with slightly different ColorInfo settings.

To identify "SDR" ColorInfo instances, we need to do some
fuzzy matching as many of the default values are assumed to
match the SDR profile even if not set.

Issue: #1158
PiperOrigin-RevId: 617473937
copybara-service bot pushed a commit to google/ExoPlayer that referenced this issue Mar 20, 2024
Some media can read color info values from the bitstream
and may partially set some of the SDR default values in
Format.ColorInfo. Setting these default values for SDR can
confuse some codecs and may also prevent adaptive ABR
switches if not all ColorInfo values are set in exactly the
same way.

We can avoid any influence of HDR color info handling by
disabling setting the color info MediaFormat keys for SDR
video and also avoid codec reset at format changes if both
formats are SDR with slightly different ColorInfo settings.

To identify "SDR" ColorInfo instances, we need to do some
fuzzy matching as many of the default values are assumed to
match the SDR profile even if not set.

Issue: androidx/media#1158
PiperOrigin-RevId: 617473937
@tonihei
Copy link
Collaborator

tonihei commented Mar 20, 2024

The commit linked above should fix the problem. Could you verify this again with your setup? Thanks!

@zubcoco
Copy link
Author

zubcoco commented Mar 25, 2024

Yes, if I compile on the main branch I don't see the problem. Thanks a lot !

@zubcoco zubcoco closed this as completed Mar 25, 2024
SheenaChhabra pushed a commit that referenced this issue Apr 8, 2024
Some media can read color info values from the bitstream
and may partially set some of the SDR default values in
Format.ColorInfo. Setting these default values for SDR can
confuse some codecs and may also prevent adaptive ABR
switches if not all ColorInfo values are set in exactly the
same way.

We can avoid any influence of HDR color info handling by
disabling setting the color info MediaFormat keys for SDR
video and also avoid codec reset at format changes if both
formats are SDR with slightly different ColorInfo settings.

To identify "SDR" ColorInfo instances, we need to do some
fuzzy matching as many of the default values are assumed to
match the SDR profile even if not set.

Issue: #1158
PiperOrigin-RevId: 617473937
(cherry picked from commit 3a7d31a)
l1068 pushed a commit to l1068org/media that referenced this issue Apr 15, 2024
Some media can read color info values from the bitstream
and may partially set some of the SDR default values in
Format.ColorInfo. Setting these default values for SDR can
confuse some codecs and may also prevent adaptive ABR
switches if not all ColorInfo values are set in exactly the
same way.

We can avoid any influence of HDR color info handling by
disabling setting the color info MediaFormat keys for SDR
video and also avoid codec reset at format changes if both
formats are SDR with slightly different ColorInfo settings.

To identify "SDR" ColorInfo instances, we need to do some
fuzzy matching as many of the default values are assumed to
match the SDR profile even if not set.

Issue: androidx#1158
PiperOrigin-RevId: 617473937
(cherry picked from commit 3a7d31a)
@androidx androidx locked and limited conversation to collaborators May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants