question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Only be 'permissive' in decoder resolution check in certain circumstances

See original GitHub issue

https://github.com/google/ExoPlayer/issues/6551 reported an issue where ExoPlayer was failing to play H264 content because it was passing the ‘display resolution’ from an HLS manifest to android.media.MediaCodecInfo.VideoCodecCapabilities#areSizeAndRateSupported. In that case the ‘display resolution’ width was 1129 but the actual samples had a width of 1130. Odd widths are illegal in H264, so the codec reported it couldn’t play the content.

The fix (https://github.com/google/ExoPlayer/commit/d874656e8a7668a83c6702413f094f6a1f509070) was to always round video dimensions based on android.media.MediaCodecInfo.VideoCodecCapabilities#getHeightAlignment and getWidthAlignment.

Unfortunately this then caused some confusion in https://github.com/google/ExoPlayer/issues/9103 when a VP8 video with an odd height (405px) failed to decode but the log said format_supported=YES because the height had been rounded to 406px before querying the decoder. Removing the rounding didn’t fix the playback error, but it changed the log to say format_supported=NO_EXCEEDS_CAPABILITIES, so it’s at least a somewhat ‘expected’ failure.

Ideally we’d only do the rounding in cases the resolution represents something other than ‘sample resolution’. i.e. if it comes from an HLS manifest, we should round. If it comes directly from a media container, we probably shouldn’t.

This info probably needs to propagated through Format.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
icbakercommented, Sep 23, 2021

There are 3 interlinked issues here:

  1. c2.android.vp8.decoder doesn’t support videos with odd resolutions. It declares this correctly (i.e. if you ask it whether it supports a video of 1280x719 then it will say “no”). This is tracked by:
  2. Codecs sometimes say “no we don’t support that resolution” when in fact playing the video works fine. This is in fact the case for the c2.qti.vp8.decoder - it also claims to only support even-resolutioned videos, but as we’ve seen it can play odd-dimensioned videos fine. Therefore if ExoPlayer can’t find any codecs that say “yes we support that resolution” we will try and play a video with one of the codecs that said it couldn’t play it, because it might work. The alternative is to not play the video at all.
  3. ExoPlayer rounds the height & width before asking the codec if it supports a particular resolution. This means that for videos with an odd resolution, we may end up asking the codec if it supports an even resolution, and it will say “yes” but then when we try to play the video it will fail.
    • This leads to one real and one theoretical problem:
      1. The logging in the error incorrectly indicates that the codec said it supported the video.
      2. If a device has two codecs that both support the MIME type in question, but only one actually declares support for the odd-dimensioned video, we may end up choosing the one that should have said “no I don’t support this video”. This could result in playback failing on a device that could play the video if we selected a different codec. As I say, this is theoretical and since the only codec we’re aware of that doesn’t support odd-dimensioned VP8 is the c2.android one, and that is generally chosen last anyway if there are other decoders on the device.
    • This is tracked by this issue.

If you have questions relating specifically to (1), please comment on #9103. Please only comment on this issue if your question is specifically about (3). I will hide all off-topic comments on this issue to keep the discussion focussed.

1reaction
icbakercommented, Sep 23, 2021

@baonq-2356 We have no plans to resolve this issue soon. As explained in various comments above it has no real-world effect on whether an odd-dimensioned VP8 video is playable on a device or not, it only changes the logging and is therefore not considered high priority.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set up the Deep Security firewall | Deep Security
In this article: Test Firewall rules before deploying them; Enable 'fail open' behavior; Turn on Firewall; Default Firewall rules; Restrictive or permissive ......
Read more >
Authorizing Permissive Use of the “Next Generation ...
1. In this Report and Order (R&O), we authorize television broadcasters to use the “Next Generation” broadcast television (Next Gen TV) ...
Read more >
Session Management - OWASP Cheat Sheet Series
Developers must ensure that the web application does not use a permissive mechanism under certain circumstances.
Read more >
Media Source Extensions™ - W3C
A unit of media data that has a presentation timestamp, a decode timestamp, ... can update the duration under certain circumstances.
Read more >
draft-klensin-idnabis-issues-01 - IETF Datatracker
Code points that require a specific context, such as occurring only ... As discussed in Section 5, the resolution check is more liberal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found