Closed Bug 1628690 Opened 5 years ago Closed 5 years ago

H264 HLS stream at Reddit RPAN does not play with widget.wayland-dmabuf-vaapi.enabled = true (unsupported H264 profile) because it fails to fall back to software decoding

Categories

(Core :: Audio/Video: Playback, defect, P5)

76 Branch
x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox-esr68 --- unaffected
firefox74 --- unaffected
firefox75 --- disabled
firefox76 --- disabled
firefox77 --- verified

People

(Reporter: valach.pavel, Assigned: stransky)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0

Steps to reproduce:

Tested with Firefox 76.0b2 (64-bit) on Ubuntu 19.10 with compiled Wayland 1.18.0 and Sway 1.4 compositor. Intel graphic drivers (Haswell).

  1. Enable "widget.wayland-dmabuf-vaapi.enabled" and ensure it works fine on Youtube and other sites.
  2. Go to https://www.reddit.com/rpan/
  3. Wait until a stream is presented and "Tuning" appears

Actual results:

The live video did not start playing, "Tuning" screen stayed on display

Expected results:

The live video should have started playing, "Tuning" should have disappeared.

Attachment #9139447 - Attachment description: rpan-with-vaapi.log → Output of (MOZ_WEBRENDER=1 MOZ_LOG="PlatformDecoderModule:5" /usr/local/bin/firefox)

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core
Component: Widget: Gtk → Audio/Video: Playback

Codec h264 profile 66 not supported for hardware decode.

https://github.com/FFmpeg/FFmpeg/blob/c52ec0367de10f86ceb5a06d25c0f948a5897740/libavcodec/avcodec.h#L2993
It's encoded with FF_PROFILE_H264_BASELINE, but VAAPI only supports the FF_PROFILE_H264_CONSTRAINED_BASELINE variant of it:

https://lists.ffmpeg.org/pipermail/ffmpeg-devel-irc/2018-March/004869.html

[15:53:27 CET] <classsict> like this: Codec h264 profile 66 not supported for hardware decode
[15:54:07 CET] <jkqxz> Indeed. No hardware supports H.264 baseline profile.

I confirmed this with my laptop:

$ vainfo
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Broadwell - 2.4.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointVLD

This bug is basically a duplicate of bug 1624103:
VAAPI is supported in general, so Firefox tries to use it, but VAAPI doesn't support this particular video and Firefox fails to fall back to software decoding.

Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Summary: H264 HLS stream at Reddit RPAN does not play with widget.wayland-dmabuf-vaapi.enabled = true → H264 HLS stream at Reddit RPAN does not play with widget.wayland-dmabuf-vaapi.enabled = true (unsupported H264 profile) because it fails to fall back to software decoding
Assignee: nobody → stransky
Status: NEW → ASSIGNED
Pushed by opoprus@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f4379cab74da [Wayland][VA-API] Respect disabled HW decoding to allow fallback to SW decoding, r=jya

Fix confirmed. Thank you! My laptop doesn't support VP9 VAAPI:

Last commit before comment 5:
LIBVA_DRIVER_NAME=i965 GDK_BACKEND=wayland MOZ_LOG="PlatformDecoderModule:5" mozregression --repo autoland --launch 7d9103e6c1df --pref gfx.webrender.all:true widget.wayland-dmabuf-vaapi.enabled:true media.ffvpx.enabled:false --process-output stdout -a https://upload.wikimedia.org/wikipedia/commons/transcoded/2/22/Volcano_Lava_Sample.webm/Volcano_Lava_Sample.webm.480p.vp9.webm

Video can't be played because the file is corrupt

Fix from comment 5:
LIBVA_DRIVER_NAME=i965 GDK_BACKEND=wayland MOZ_LOG="PlatformDecoderModule:5" mozregression --repo autoland --launch f4379cab74da --pref gfx.webrender.all:true widget.wayland-dmabuf-vaapi.enabled:true media.ffvpx.enabled:false --process-output stdout -a https://upload.wikimedia.org/wikipedia/commons/transcoded/2/22/Volcano_Lava_Sample.webm/Volcano_Lava_Sample.webm.480p.vp9.webm

0:34.55 INFO: [AVHWDeviceContext @ 0x7f4cccd22080] VAAPI driver: Intel i965 driver for Intel(R) Broadwell - 2.4.0.
0:34.55 INFO: [AVHWDeviceContext @ 0x7f4cccd22080] Driver not found in known nonstandard list, using standard behaviour.
0:34.55 INFO: [Child 19802: MediaPDecoder #1]: D/PlatformDecoderModule VA-API FFmpeg init successful
0:34.55 INFO: [Child 19802: MediaPDecoder #2]: D/PlatformDecoderModule Choosing FFmpeg pixel format for VA-API video decoding.
0:34.55 INFO: [Child 19802: MediaPDecoder #2]: D/PlatformDecoderModule Requesting pixel format VAAPI_VLD
0:34.55 INFO: [vp9 @ 0x7f4cccf63800] Format vaapi_vld chosen by get_format().
0:34.55 INFO: [vp9 @ 0x7f4cccf63800] Format vaapi_vld requires hwaccel initialisation.
0:34.55 INFO: [vp9 @ 0x7f4cccf63800] No support for codec vp9 profile 0.
0:34.55 INFO: [vp9 @ 0x7f4cccf63800] Failed setup for format vaapi_vld: hwaccel initialisation returned error.
0:34.55 INFO: [vp9 @ 0x7f4cccf63800] Format vaapi_vld not usable, retrying get_format() without it.
0:34.55 INFO: [Child 19802: MediaPDecoder #2]: D/PlatformDecoderModule Choosing FFmpeg pixel format for VA-API video decoding.
0:34.55 INFO: [vp9 @ 0x7f4cccf63800] Failed to initialize decoder for 854x480 @ 0
0:34.55 INFO: [Child 19802: MediaPDecoder #2]: D/PlatformDecoderModule avcodec_send_packet error: -1
0:35.72 INFO: [Child 19802: MediaPlayback #1]: D/PlatformDecoderModule Sandbox decoder rejects requested type
0:35.72 INFO: [Child 19802: MediaPDecoder #3]: D/PlatformDecoderModule Initialising FFmpeg decoder.
0:35.72 INFO: [Child 19802: MediaPDecoder #3]: D/PlatformDecoderModule FFmpeg init successful.
0:35.72 INFO: [Child 19802: MediaPDecoder #1]: D/PlatformDecoderModule Choosing FFmpeg pixel format for video decoding.
0:35.72 INFO: [Child 19802: MediaPDecoder #1]: D/PlatformDecoderModule Requesting pixel format YUV420P.
0:35.72 INFO: [vp9 @ 0x7f4cd5839000] Format yuv420p chosen by get_format().
0:35.72 INFO: [Child 19802: MediaPDecoder #1]: D/PlatformDecoderModule Got one frame output with pts=4000 dts=4000 duration=33000 opaque=-9223372036854775808

Video plays.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77

I verified that it introduced a fallback to software decoding for unsupported codecs/profiles and that H264 hardware decoding still works.
Should this be uplifted into Beta?

Flags: needinfo?(stransky)

(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #8)

I verified that it introduced a fallback to software decoding for unsupported codecs/profiles and that H264 hardware decoding still works.
Should this be uplifted into Beta?

Last two uplift requests for vaapi fixes were rejected, I don't thing media folks want to uplift such changes.

Flags: needinfo?(stransky)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: