Video playback errors only when using CefDoMessageLoopWork

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Video playback errors only when using CefDoMessageLoopWork

Postby cybersight » Wed Jan 24, 2024 9:13 am

With multi-threaded message loop enabled, I'm able to play videos like https://www.youtube.com/watch?v=PNsmvW6r-hg just fine.

However, if I disable multi_threaded_message_loop and use CefDoMessageLoopWork instead, I get a bunch of errors in my CEF log culminating in a divide by zero exception that crashes the browser.

I know that CEF needs to be built with priority codecs to support certain video playback, but why would the behavior differ depending on whether I'm using a multi-threaded message loop?

Here are the logs in each case for comparison.

With multi-threaded message loop (video plays fine):

Code: Select all
[0124/145112.546:INFO:chunk_demuxer.cc(472)] ChunkDemuxer
[0124/145113.394:INFO:chunk_demuxer.cc(472)] ChunkDemuxer
[0124/145114.603:INFO:CONSOLE(0)] "The resource https://i.ytimg.com/generate_204 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://www.youtube.com/watch?v=ex3C1-5Dhb8 (0)
[0124/145114.921:INFO:decoder_stream.cc(442)] Selected FFmpegAudioDecoder for audio decoding, config: codec: opus, profile: unknown, bytes_per_channel: 4, channel_layout: STEREO, channels: 2, samples_per_second: 48000, sample_format: Float 32-bit, bytes_per_frame: 8, seek_preroll: 80000us, codec_delay: 312, has extra data: true, encryption scheme: Unencrypted, discard decoder delay: true, target_output_channel_layout: STEREO, target_output_sample_format: Unknown sample format, has aac extra data: false
[0124/145114.921:INFO:decoder_selector.cc(315)] Cannot select DecryptingVideoDecoder for video decoding
[0124/145114.921:INFO:decoder_selector.cc(315)] Cannot select D3D11VideoDecoder for video decoding
[0124/145114.921:INFO:decoder_selector.cc(315)] Cannot select VpxVideoDecoder for video decoding
[0124/145114.924:INFO:decoder_stream.cc(442)] Selected Dav1dVideoDecoder for video decoding, config: codec: av1, profile: av1 profile main, level: not available, alpha_mode: is_opaque, coded size: [854,480], visible rect: [0,0,854,480], natural size: [854,480], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
[0124/145114.930:INFO:web_media_player_impl.cc(1071)] Effective playback rate changed from 0 to 1
[0124/145123.168:INFO:CONSOLE(0)] "The resource https://i.ytimg.com/generate_204 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://www.youtube.com/watch?v=ex3C1-5Dhb8 (0)
[0124/145124.308:INFO:decoder_stream.cc(851)] video decoder config changed midstream, new config: codec: av1, profile: av1 profile main, level: not available, alpha_mode: is_opaque, coded size: [1280,720], visible rect: [0,0,1280,720], natural size: [1280,720], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
[0124/145124.313:INFO:decoder_stream.cc(442)] Selected Dav1dVideoDecoder for video decoding, config: codec: av1, profile: av1 profile main, level: not available, alpha_mode: is_opaque, coded size: [1280,720], visible rect: [0,0,1280,720], natural size: [1280,720], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
[0124/145129.686:INFO:CONSOLE(0)] "The resource https://i.ytimg.com/generate_204 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://www.youtube.com/watch?v=ex3C1-5Dhb8 (0)



Without multi-threaded message loop (crashes browser):
Code: Select all
[0124/145922.236:INFO:web_media_player_impl.cc(1071)] Effective playback rate changed from 0 to 1
[0124/145922.267:INFO:ffmpeg_demuxer.cc(214)] Warning, FFmpegDemuxer failed to create a valid/supported audio decoder configuration from muxed stream, config:codec: aac, profile: unknown, bytes_per_channel: 0, channel_layout: MONO, channels: 1, samples_per_second: 44100, sample_format: Unknown sample format, bytes_per_frame: 0, seek_preroll: 0us, codec_delay: 0, has extra data: true, encryption scheme: Unencrypted, discard decoder delay: true, target_output_channel_layout: NONE, target_output_sample_format: Unknown sample format, has aac extra data: false
[0124/145922.267:INFO:ffmpeg_demuxer.cc(1365)] FFmpegDemuxer: skipping invalid or unsupported audio track
[0124/145922.267:ERROR:ffmpeg_demuxer.cc(1470)] FFmpegDemuxer: no supported streams
[0124/145922.267:INFO:ffmpeg_demuxer.cc(214)] Warning, FFmpegDemuxer failed to create a valid/supported audio decoder configuration from muxed stream, config:codec: aac, profile: unknown, bytes_per_channel: 0, channel_layout: MONO, channels: 1, samples_per_second: 44100, sample_format: Unknown sample format, bytes_per_frame: 0, seek_preroll: 0us, codec_delay: 0, has extra data: true, encryption scheme: Unencrypted, discard decoder delay: true, target_output_channel_layout: NONE, target_output_sample_format: Unknown sample format, has aac extra data: false
[0124/145922.268:INFO:ffmpeg_demuxer.cc(1365)] FFmpegDemuxer: skipping invalid or unsupported audio track
[0124/145922.268:ERROR:ffmpeg_demuxer.cc(1470)] FFmpegDemuxer: no supported streams
[0124/145922.268:INFO:ffmpeg_demuxer.cc(214)] Warning, FFmpegDemuxer failed to create a valid/supported audio decoder configuration from muxed stream, config:codec: aac, profile: unknown, bytes_per_channel: 0, channel_layout: MONO, channels: 1, samples_per_second: 44100, sample_format: Unknown sample format, bytes_per_frame: 0, seek_preroll: 0us, codec_delay: 0, has extra data: true, encryption scheme: Unencrypted, discard decoder delay: true, target_output_channel_layout: NONE, target_output_sample_format: Unknown sample format, has aac extra data: false
[0124/145922.268:INFO:ffmpeg_demuxer.cc(1365)] FFmpegDemuxer: skipping invalid or unsupported audio track
[0124/145922.268:ERROR:ffmpeg_demuxer.cc(1470)] FFmpegDemuxer: no supported streams
[0124/145922.269:INFO:ffmpeg_demuxer.cc(214)] Warning, FFmpegDemuxer failed to create a valid/supported audio decoder configuration from muxed stream, config:codec: aac, profile: unknown, bytes_per_channel: 0, channel_layout: MONO, channels: 1, samples_per_second: 44100, sample_format: Unknown sample format, bytes_per_frame: 0, seek_preroll: 0us, codec_delay: 0, has extra data: true, encryption scheme: Unencrypted, discard decoder delay: true, target_output_channel_layout: NONE, target_output_sample_format: Unknown sample format, has aac extra data: false
[0124/145922.269:INFO:ffmpeg_demuxer.cc(1365)] FFmpegDemuxer: skipping invalid or unsupported audio track
[0124/145922.269:ERROR:ffmpeg_demuxer.cc(1470)] FFmpegDemuxer: no supported streams
[0124/145922.286:INFO:decoder_stream.cc(442)] Selected FFmpegAudioDecoder for audio decoding, config: codec: opus, profile: unknown, bytes_per_channel: 4, channel_layout: STEREO, channels: 2, samples_per_second: 48000, sample_format: Float 32-bit, bytes_per_frame: 8, seek_preroll: 80000us, codec_delay: 312, has extra data: true, encryption scheme: Unencrypted, discard decoder delay: true, target_output_channel_layout: STEREO, target_output_sample_format: Unknown sample format, has aac extra data: false
[0124/145922.286:INFO:decoder_selector.cc(315)] Cannot select DecryptingVideoDecoder for video decoding
[0124/145922.288:ERROR:html_media_element.cc(4867)] SetError: {code=4, message="DEMUXER_ERROR_NO_SUPPORTED_STREAMS: FFmpegDemuxer: no supported streams"}
[0124/145922.289:ERROR:html_media_element.cc(4867)] SetError: {code=4, message="DEMUXER_ERROR_NO_SUPPORTED_STREAMS: FFmpegDemuxer: no supported streams"}
[0124/145922.289:ERROR:html_media_element.cc(4867)] SetError: {code=4, message="DEMUXER_ERROR_NO_SUPPORTED_STREAMS: FFmpegDemuxer: no supported streams"}
[0124/145922.289:ERROR:html_media_element.cc(4867)] SetError: {code=4, message="DEMUXER_ERROR_NO_SUPPORTED_STREAMS: FFmpegDemuxer: no supported streams"}
[0124/145922.297:INFO:d3d11_decoder_configurator.cc(130)] D3D11VideoDecoder is using vp9 profile0 / 4:2:0
[0124/145922.297:INFO:d3d11_texture_selector.cc(93)] D3D11VideoDecoder producing NV12
[0124/145922.297:INFO:d3d11_texture_selector.cc(102)] D3D11VideoDecoder: Selected NV12
[0124/145922.297:INFO:d3d11_texture_selector.cc(170)] D3D11VideoDecoder output color space: (same as input)
[0124/145922.297:INFO:d3d11_texture_selector.cc(182)] D3D11VideoDecoder is binding textures
[0124/145922.299:INFO:d3d11_video_decoder.cc(307)] D3D11VideoDecoder is using single textures
[0124/145922.308:INFO:d3d11_video_decoder.cc(1069)] Selected D3D11VideoDecoder adapter LUID:{0, 51718}
[0124/145922.308:INFO:d3d11_video_decoder.cc(433)] Video is supported by D3D11VideoDecoder
[0124/145922.309:INFO:decoder_stream.cc(442)] Selected D3D11VideoDecoder for video decoding, config: codec: vp9, profile: vp9 profile0, level: not available, alpha_mode: is_opaque, coded size: [854,480], visible rect: [0,0,854,480], natural size: [854,480], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
[0124/145922.312:INFO:d3d11_video_decoder.cc(657)] D3D11VideoDecoder config change: profile: vp9 profile0, chroma_sampling_format: 4:2:0, coded_size: 854x480, bit_depth: 8, color_space: {primary=1, transfer=1, matrix=1, range=1}
[0124/145922.313:INFO:d3d11_decoder_configurator.cc(130)] D3D11VideoDecoder is using vp9 profile0 / 4:2:0
[0124/145922.313:INFO:d3d11_texture_selector.cc(93)] D3D11VideoDecoder producing NV12
[0124/145922.313:INFO:d3d11_texture_selector.cc(102)] D3D11VideoDecoder: Selected NV12
[0124/145922.313:INFO:d3d11_texture_selector.cc(170)] D3D11VideoDecoder output color space: (same as input)
[0124/145922.313:INFO:d3d11_texture_selector.cc(182)] D3D11VideoDecoder is binding textures
[0124/145922.315:INFO:d3d11_video_decoder.cc(307)] D3D11VideoDecoder is using single textures
[0124/145936.973:INFO:decoder_stream.cc(851)] video decoder config changed midstream, new config: codec: vp9, profile: vp9 profile0, level: not available, alpha_mode: is_opaque, coded size: [1280,720], visible rect: [0,0,1280,720], natural size: [1280,720], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
[0124/145936.974:INFO:d3d11_decoder_configurator.cc(130)] D3D11VideoDecoder is using vp9 profile0 / 4:2:0
[0124/145936.974:INFO:d3d11_texture_selector.cc(93)] D3D11VideoDecoder producing NV12
[0124/145936.975:INFO:d3d11_texture_selector.cc(102)] D3D11VideoDecoder: Selected NV12
[0124/145936.975:INFO:d3d11_texture_selector.cc(170)] D3D11VideoDecoder output color space: (same as input)
[0124/145936.975:INFO:d3d11_texture_selector.cc(182)] D3D11VideoDecoder is binding textures
[0124/145936.977:INFO:d3d11_video_decoder.cc(307)] D3D11VideoDecoder is using single textures
[0124/145936.986:INFO:d3d11_video_decoder.cc(1069)] Selected D3D11VideoDecoder adapter LUID:{0, 51718}
[0124/145936.986:INFO:d3d11_video_decoder.cc(433)] Video is supported by D3D11VideoDecoder
[0124/145936.986:INFO:decoder_stream.cc(442)] Selected D3D11VideoDecoder for video decoding, config: codec: vp9, profile: vp9 profile0, level: not available, alpha_mode: is_opaque, coded size: [1280,720], visible rect: [0,0,1280,720], natural size: [1280,720], has extra data: false, encryption scheme: Unencrypted, rotation: 0°, flipped: 0, color space: {primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}
[0124/145937.006:INFO:d3d11_video_decoder.cc(657)] D3D11VideoDecoder config change: profile: vp9 profile0, chroma_sampling_format: 4:2:0, coded_size: 1280x720, bit_depth: 8, color_space: {primary=1, transfer=1, matrix=1, range=1}
[0124/145937.007:INFO:d3d11_decoder_configurator.cc(130)] D3D11VideoDecoder is using vp9 profile0 / 4:2:0
[0124/145937.007:INFO:d3d11_texture_selector.cc(93)] D3D11VideoDecoder producing NV12
[0124/145937.007:INFO:d3d11_texture_selector.cc(102)] D3D11VideoDecoder: Selected NV12
[0124/145937.007:INFO:d3d11_texture_selector.cc(170)] D3D11VideoDecoder output color space: (same as input)
[0124/145937.007:INFO:d3d11_texture_selector.cc(182)] D3D11VideoDecoder is binding textures
[0124/145937.008:INFO:d3d11_video_decoder.cc(307)] D3D11VideoDecoder is using single textures
[0124/145959.966:FATAL:context.cc(345)] Check failed: false. context not valid
cybersight
Techie
 
Posts: 38
Joined: Mon Dec 11, 2023 11:04 am

Re: Video playback errors only when using CefDoMessageLoopWo

Postby magreenblatt » Wed Jan 24, 2024 1:33 pm

What OS and CEF version?

but why would the behavior differ depending on whether I'm using a multi-threaded message loop?

Likely there is some issue with your app's usage of CefDoMessageLoopWork, or with CefDoMessageLoopWork in general. How does it behave with "cefclient --external-message-pump"?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Video playback errors only when using CefDoMessageLoopWo

Postby cybersight » Thu Jan 25, 2024 2:48 am

magreenblatt wrote:What OS and CEF version?


Windows 10, CEF 6099.

How does it behave with "cefclient --external-message-pump"?


Same behavior. The browser crashes with the same error messages in CEF logs.

Likely there is some issue with your app's usage of CefDoMessageLoopWork, or with CefDoMessageLoopWork in general.


My usage is calling CefDoMessageLoopWork after the top level message loop that processes Win32 events, which ends up being about 20 times a second or once every 50ms. Maybe that isn't fast enough?

I haven't implemented the OnScheduleMessagePumpWork callback yet, though that seems like a secondary problem and would probably just slow it down at this point.

And to be clear, using my app to navigate around sites like Wikipedia and this forum work just fine with CefDoMessageLoopWork. It's only when I watch a Youtube video that it crashes.
cybersight
Techie
 
Posts: 38
Joined: Mon Dec 11, 2023 11:04 am

Re: Video playback errors only when using CefDoMessageLoopWo

Postby magreenblatt » Thu Jan 25, 2024 11:29 am

about 20 times a second

Possibly either too slow or too inaccurate for audio/video playback.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Video playback errors only when using CefDoMessageLoopWo

Postby cybersight » Mon Jan 29, 2024 11:50 am

magreenblatt wrote:
about 20 times a second

Possibly either too slow or too inaccurate for audio/video playback.


But would that explain the errors?

The browser crashes immediately, before rendering the first frame of the video.
cybersight
Techie
 
Posts: 38
Joined: Mon Dec 11, 2023 11:04 am

Re: Video playback errors only when using CefDoMessageLoopWo

Postby cybersight » Mon Feb 05, 2024 9:23 pm

Okay, I think I figured out the problem. The platform I'm using (Dolphin Smalltalk) unmasks some floating point exceptions that are masked by default in C/C++.

If I mask divide by zero exceptions (_EM_ZERODIVIDE), the video plays correctly.
cybersight
Techie
 
Posts: 38
Joined: Mon Dec 11, 2023 11:04 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 194 guests

cron