sdl_opengl_player(.cpp) doesn't work well as expect

This forum is about all development around libVLC.
onelistme
New Cone
New Cone
Posts: 8
Joined: 26 Dec 2020 14:07

sdl_opengl_player(.cpp) doesn't work well as expect

Postby onelistme » 26 Dec 2020 17:26

File: https://github.com/videolan/vlc/tree/master/doc/libvlc /sdl_opengl_player.cpp
Platform: Windows
OS: Win7 x64
LibVLC:4.0.0 Dev Nightly Build
This example doesn’t work well as expect.
sdl_opengl_player using of CPU is about 30% When Playing mp4 file 1080p@30Hz with an Intel i5 laptop, However, it is only about 3% for the released player(also the same with simplest player using LibVLC). As we know all the OpenGL works on GPU,there seems no extra CPU works comparing with a usually player. Does the SDL WINDOW consume such more CPU?

FIRST(1):For video it isn’t smooth, the picture is “pause” and the sound is going on.
Log Info:
main generic debug: using hw decoder module "dxva2"
main decoder debug: vout change: chroma
main video output debug: deinterlace -1, mode auto, is_needed 0
main video output debug: Opening vout display wrapper
main generic debug: looking for vout display module matching "gl": 12
candidates
main generic debug: looking for opengl module matching "vgl": 2 candidates
main generic debug: using opengl module "vgl"
main generic debug: looking for glinterop module matching "any": 2 candidates
main generic debug: no glinterop modules matched
gl gl debug: PBO support enabled
gl gl debug:
=== Vertex shader for fourcc: I420 ===
…………………………
…………………………
…………………………
avcodec decoder debug: available hardware decoder output format 174 (d3d11)
avcodec decoder debug: available software decoder output format 0 (yuv420p)
avcodec decoder debug: reusing decoder output format 53
main decoder debug: Received first picture
main input debug: Buffering 100%
main input debug: Stream buffering done (1250 ms in 456 ms)
main input debug: Decoder wait done in 0 ms
main input error: ES_OUT_SET_(GROUP_)PCR is called 9 ms late (pts_delay increased to 1009 ms)
main input debug: ES_OUT_RESET_PCR called
main input debug: Buffering 0%
main input debug: Buffering 24%
main input debug: Buffering 49%
avcodec decoder debug: available hardware decoder output format 119 (cuda)
main input debug: Buffering 74%
avcodec decoder debug: available hardware decoder output format 53 (dxva2_vld)
main input debug: Buffering 99%
main input debug: Stream buffering done (1250 ms in 160 ms)
avcodec decoder debug: available hardware decoder output format 118 (d3d11va_vld)
avcodec decoder debug: available hardware decoder output format 174 (d3d11)
avcodec decoder debug: available software decoder output format 0 (yuv420p)
avcodec decoder debug: reusing decoder output format 53
main decoder debug: Received first picture
main input debug: Decoder wait done in 194 ms
main video output warning: picture is too late to be displayed (missing 204 ms)
main video output warning: picture is too late to be displayed (missing 195 ms)
main video output warning: picture is too late to be displayed (missing 180 ms)
main video output warning: picture is too late to be displayed (missing 155 ms)
main video output warning: picture is too late to be displayed (missing 131 ms)
main input error: ES_OUT_SET_(GROUP_)PCR is called 976 ms late (pts_delay increased to 1739 ms)
main video output warning: picture is too late to be displayed (missing 494 ms)
main input debug: ES_OUT_RESET_PCR called
main decoder debug: Received first picture
main input debug: Buffering 0%
main input debug: Buffering 14%
avcodec decoder debug: available hardware decoder output format 119 (cuda)
avcodec decoder debug: available hardware decoder output format 53 (dxva2_vld)
avcodec decoder debug: available hardware decoder output format 118 (d3d11va_vld)
avcodec decoder debug: available hardware decoder output format 174 (d3d11)



Second(2): For some video like this sound is OK and no video shown but Black.

0x000007FEFDACA06D (KernelBase.dll)at (in Player.exe ) exception:
0x20474343 (refer: 0x0000000027F26800)。
main input debug: control type=27
main subpicture warning: original picture size is undefined
main input debug: control type=27
main input debug: control type=27
main video output warning: picture is too late to be displayed (missing 150ms)
main video output warning: picture is too late to be displayed (missing 171 ms)
main video output warning: picture is too late to be displayed (missing 201 ms)
main video output warning: picture is too late to be displayed (missing 210 ms)
main video output warning: picture is too late to be displayed (missing 195 ms)
main video output warning: picture is too late to be displayed (missing 209 ms)
main video output warning: picture is too late to be displayed (missing 201 ms)
main video output warning: picture is too late to be displayed (missing 232 ms)
main decoder debug: vout change: multiview
main video output debug: requested window size: 3840x1080
Thread 0x4548 is exit,Returen 0 (0x0)。
main video output debug: deinterlace -1, mode auto, is_needed 0
0x000007FEEA6D9B0D (libvlccore.dll)at (in Player.exe ) exception:
0xC0000005: Read location 0x000000002717FA08 when conflict occur.

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

Re: sdl_opengl_player(.cpp) doesn't work well as expect

Postby chubinou » 05 Jan 2021 17:28

In the first case it looks like the hardware decoder is created in loop: decode 1 image then recreate the decoder due to an issue (?). which would explain the stuttering.

Can you try to run your media in VLC with the opengl video output selected to see if you have the same issue? (by default it output to direct3D so you're a bit comparing apples to oranges).

You can also try to disable hw acceleration in your sample program to see if it the video plays correctly (pass --no-hw-dec). it won't solve your performance issue though

For the second case, it's a bit hard to tell, there isn't much logs.

0x000007FEEA6D9B0D (libvlccore.dll)at (in Player.exe ) exception

look like somethings crashed

onelistme
New Cone
New Cone
Posts: 8
Joined: 26 Dec 2020 14:07

Re: sdl_opengl_player(.cpp) doesn't work well as expect

Postby onelistme » 11 Jan 2021 10:42

For the first video:
When I disable hw acceleration as your(@chubinou) advide (pass --no-hw-dec), The same with before, It seems that hardware acceleration doesn't open correctly.--> CPU using is the same as before.

2) When disable hw acceleration and play second video. the picture comes out, but it not smooth and all times buffering.

The LibVLC used are LibVLC:4.0.0 Dev Nightly Build. It's OK for simple player( without function libvlc_video_set_output_callbacks() ) based the same LibVLC:4.0.0 . I guess there some thing wrong when using the function ---libvlc_video_set_output_callbacks ---. any more advices?

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: sdl_opengl_player(.cpp) doesn't work well as expect

Postby unidan » 03 Feb 2021 09:00

Hi,

This is tracked upstream as https://trac.videolan.org/vlc/ticket/25234. The issue is that hardware decoding interops are not used because platform extensions are not available through the callbacks. We're investigating a way to have them anyway. I'll keep you posted.



Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 16 guests