Page 2 of 2
Re: libvlc 1.1.0 not freeing resources
Posted: 08 Jul 2010 18:05
by AEtH
Compiling myself is not a problem, I compiled 1.0.6 twice when I needed it. What I'm talking about is about log messages in win32, those obtained with libvlc_iterator_next(). I'm totally uncapable of obtaining any message under win32, but libvlc_log_count() returns me the total log messages everytime a call it, so I know that there are messages but I cannot obtain them.
Re: libvlc 1.1.0 not freeing resources
Posted: 08 Jul 2010 21:01
by Jean-Baptiste Kempf
The related code is not big, a few thousands line of code, in modules/video_output/msw/
Compiling VLC for windows is not that difficult nowadays.
Re: libvlc 1.1.0 not freeing resources
Posted: 08 Jul 2010 23:22
by AEtH
Yes, I found myself the modules involving win32 video output. I'll try to understand the changes involved in 1.1.0, comparing the new functions with those functions in 1.0.6. Should I ask questions regarding those modules to you or to someone else? Besides, it would be so helpfull knowing how the functions are called, because I suppose that the functions in 1.0.6 will not work in 1.1.0.
Re: libvlc 1.1.0 not freeing resources
Posted: 09 Jul 2010 00:12
by Jean-Baptiste Kempf
1.1.1 has huge changes in video output modules. You cannot just use the 1.0.6 code. You need to fix 1.1.0 code.
Re: libvlc 1.1.0 not freeing resources
Posted: 09 Jul 2010 00:46
by AEtH
Yes, I supossed that. Can I use the libvlc logging functions or they are broken in win32?? I tried some of them but they seem a little buggy.
Re: libvlc 1.1.0 not freeing resources
Posted: 09 Jul 2010 15:09
by XilasZ
Log functions works well in windows, i've used them since almost two years now. It's a little tricky to use, but it works.
You can take a look at my sources here (
http://fritivi.git.sourceforge.net/git/ ... ;a=summary), and specifically the
wrapper and the
log window.
The code use v1.0.x, But it works the same way with 1.1, just remove the exceptions.
Re: libvlc 1.1.0 not freeing resources
Posted: 10 Jul 2010 20:54
by AEtH
Well... I made logging work, maybe with a debug output I can see anything. Thanks for the piece of code XilasZ, I had everything solved... but if I get a log iterator just before the creation of the libvlc instance... there is a really BIG chance that there are no logged messages, that's why I did not obtained anything
Thanks
Re: libvlc 1.1.0 not freeing resources
Posted: 16 Jul 2010 16:14
by Jean-Baptiste Kempf
Did you solve the resources issues?
Re: libvlc 1.1.0 not freeing resources
Posted: 16 Jul 2010 18:47
by AEtH
I'm on holiday, until monday I'll not start again. As my fiancee thinks that programming is "job", I had to slow down a bit. On monday I'll begin again, but now I can get log messages, so maybe this can help a lot. I'll post the results of the debugging around tuesday.
Re: libvlc 1.1.0 not freeing resources
Posted: 16 Jul 2010 22:25
by Jean-Baptiste Kempf
Re: libvlc 1.1.0 not freeing resources
Posted: 19 Jul 2010 11:36
by AEtH
Well, I have some news, I noticed some differences between 1.0.6 and 1.1.1 involving closing directX:
First, let's go with
1.0.6. This is the log involving video opening (just the directX part):
Code: Select all
[VIDEO OUTPUT] [VOUT_DIRECTX] --> creating DirectXEventThread
[GENERIC] [MAIN] ---------------> thread (Vout Events Thread) created at priority 0 (directx.c:282)
[GENERIC] [MAIN] ---------------> thread started
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXCreateWindow
[WINDOW] [MAIN] ----------------> looking for hwnd module: 1 candidate
[WINDOW] [MAIN] ----------------> using hwnd module "drawable"
[VIDEO OUTPUT] [VOUT_DIRECTX] --> created video sub-window
[VIDEO OUTPUT] [VOUT_DIRECTX] --> Vout EventThread running
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXInitDDraw
[VIDEO OUTPUT] [VOUT_DIRECTX] --> directx-device:
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXEnumCallback: Controlador de pantalla primaria, display
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXEnumCallback: NVIDIA Quadro NVS 285, \\.\DISPLAY1
[VIDEO OUTPUT] [VOUT_DIRECTX] --> selecting NVIDIA Quadro NVS 285, \\.\DISPLAY1
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXEnumCallback: NVIDIA Quadro NVS 285, \\.\DISPLAY2
[VIDEO OUTPUT] [VOUT_DIRECTX] --> screen dimensions (0x0,1280x1024)
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectDraw Capabilities: overlay=1 yuvoverlay=1 can_deinterlace_overlay=1 colorkey=1 stretch=1 bltfourcc=1
[VIDEO OUTPUT] [VOUT_DIRECTX] --> align_boundary_src=0,0 align_boundary_dest=1,1 align_size_src=0,0 align_size_dest=0,0
[VIDEO OUTPUT] [VOUT_DIRECTX] --> End DirectXInitDDraw
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXCreateDisplay
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXCreateClipper
[VIDEO OUTPUT] [VOUT_DIRECTX] --> disabling screen saver
[VIDEO OUTPUT] [MAIN] ----------> using video output module "vout_directx"
[VIDEO OUTPUT] [MAIN] ----------> Deinterlacing available
[VIDEO OUTPUT] [VOUT_DIRECTX] --> NewPictureVec overlay:yes chroma:YV12
[VIDEO OUTPUT] [VOUT_DIRECTX] --> End NewPictureVec (failed)
[VIDEO OUTPUT] [VOUT_DIRECTX] --> NewPictureVec overlay:yes chroma:YV12
[VIDEO OUTPUT] [VOUT_DIRECTX] --> End NewPictureVec (failed)
[VIDEO OUTPUT] [VOUT_DIRECTX] --> NewPictureVec overlay:yes chroma:YUY2
[VIDEO OUTPUT] [VOUT_DIRECTX] --> End NewPictureVec (failed)
[VIDEO OUTPUT] [VOUT_DIRECTX] --> Could not initialize directx overlay
[VIDEO OUTPUT] [VOUT_DIRECTX] --> NewPictureVec overlay:no chroma:YV12
[VIDEO OUTPUT] [VOUT_DIRECTX] --> created plain surface of chroma:YV12
[VIDEO OUTPUT] [VOUT_DIRECTX] --> End NewPictureVec (succeeded)
[VIDEO OUTPUT] [MAIN] ----------> got 1 direct buffer(s)
[VIDEO OUTPUT] [MAIN] ----------> pic render sz 384x288, of (0,0), vsz 384x288, 4cc I420, ar 270857:216000, sar 1:1, msk r0x0 g0x0 b0x0
[VIDEO OUTPUT] [MAIN] ----------> pic in sz 384x288, of (0,0), vsz 384x288, 4cc I420, ar 270857:216000, sar 79:84, msk r0x0 g0x0 b0x0
[VIDEO OUTPUT] [MAIN] ----------> pic out sz 384x288, of (0,0), vsz 384x288, 4cc I420, ar 270857:216000, sar 79:84, msk r0x0 g0x0 b0x0
[VIDEO OUTPUT] [MAIN] ----------> direct render, mapping render pictures 0-14 to system pictures 1-15
[DECODER] [MAIN] ---------------> End of video preroll
And this is the log involving video closing:
Code: Select all
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXCloseSurface
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXCloseDisplay
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXCloseDisplay clipper
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXCloseDisplay display
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXCloseDDraw
[GENERIC] [VOUT_DIRECTX] -------> DirectXEventThread terminating
[VIDEO OUTPUT] [VOUT_DIRECTX] --> DirectXCloseWindow
[VIDEO OUTPUT] [VOUT_DIRECTX] --> WinProc WM_DESTROY
[WINDOW] [MAIN] ----------------> removing module "drawable"
[GENERIC] [MAIN] ---------------> thread ended
[GENERIC] [MAIN] ---------------> thread times: real 0m8.218750s, kernel 0m0.000000s, user 0m0.000000s
[VIDEO OUTPUT] [MAIN] ----------> removing module "vout_directx"
Now, let's go with
1.1.1. This is the log involving video opening (just the directX part):
Code: Select all
[GENERIC] [DIRECTX] ------------> creating Vout EventThread
[GENERIC] [DIRECTX] ------------> DirectXCreateWindow
[WINDOW] [MAIN] ----------------> looking for vout window hwnd module: 1 candidate
[WINDOW] [MAIN] ----------------> using vout window hwnd module "drawable"
[GENERIC] [DIRECTX] ------------> created video sub-window
[GENERIC] [DIRECTX] ------------> Vout EventThread running
[GENERIC] [DIRECTX] ------------> disabling screen saver
[GENERIC] [DIRECTX] ------------> directx-device:
[GENERIC] [DIRECTX] ------------> DirectXEnumCallback: NVIDIA Quadro NVS 285, \\.\DISPLAY1
[GENERIC] [DIRECTX] ------------> selecting NVIDIA Quadro NVS 285, \\.\DISPLAY1
[GENERIC] [DIRECTX] ------------> DirectXEnumCallback: NVIDIA Quadro NVS 285, \\.\DISPLAY2
[GENERIC] [DIRECTX] ------------> screen dimensions (0x0,1280x1024)
[GENERIC] [DIRECTX] ------------> DirectDraw Capabilities: overlay=1 yuvoverlay=1 can_deinterlace_overlay=1 colorkey=1 stretch=1 bltfourcc=1
[GENERIC] [DIRECTX] ------------> align_boundary_src=0,0 align_boundary_dest=1,1 align_size_src=0,0 align_size_dest=0,0
[GENERIC] [MAIN] ---------------> VoutDisplayEvent 'resize' 392x322 window
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_dst_clipped coords: 642,784,1034,1024
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_src_clipped coords: 0,0,384,236
[GENERIC] [DIRECTX] ------------> YUV plain surface created successfully
[GENERIC] [MAIN] ---------------> using vout display module "directx"
[VIDEO OUTPUT] [MAIN] ----------> option direct3d-desktop does not exist
[VIDEO OUTPUT] [MAIN] ----------> using video output module "vout_wrapper"
[VIDEO OUTPUT] [MAIN] ----------> got 1 direct buffer(s)
[VIDEO OUTPUT] [MAIN] ----------> pic render sz 384x288, of (0,0), vsz 384x288, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0
[VIDEO OUTPUT] [MAIN] ----------> pic in sz 384x288, of (0,0), vsz 384x288, 4cc I420, sar 79:84, msk r0x0 g0x0 b0x0
[VIDEO OUTPUT] [MAIN] ----------> pic out sz 384x288, of (0,0), vsz 384x288, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0
[VIDEO OUTPUT] [MAIN] ----------> direct render, mapping render pictures 0-23 to system pictures 1-24
[GENERIC] [MAIN] ---------------> VoutDisplayEvent 'resize' 316x252 window
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_dst_clipped coords: 642,777,958,1014
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_src_clipped coords: 0,0,384,288
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_dst_clipped coords: 642,770,958,1022
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_src_clipped coords: 0,0,384,288
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_dst_clipped coords: 642,770,958,1022
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_src_clipped coords: 0,0,384,288
[DECODER] [AVCODEC] ------------> using direct rendering
[DECODER] [MAIN] ---------------> End of video preroll
And this is the log involving video closing:
Code: Select all
[GENERIC] [DIRECTX] ------------> DirectXEventThread terminating
[GENERIC] [DIRECTX] ------------> DirectXCloseWindow
[GENERIC] [DIRECTX] ------------> WinProc WM_DESTROY
[WINDOW] [MAIN] ----------------> removing module "drawable"
[GENERIC] [MAIN] ---------------> removing module "directx"
[VIDEO OUTPUT] [MAIN] ----------> removing module "vout_wrapper"
Am I missing something or there is a bunch of code referring closing surfaces in 1.0.6 that doesn't exists in 1.1.1? Anyway, the application is running, maybe the debug of the crash can tell us more.
Re: libvlc 1.1.0 not freeing resources
Posted: 19 Jul 2010 20:30
by fenrir
There has been some debug messages removed explaining the differences in the logs.
About the leak you experience, could you try the following patch ?
Code: Select all
diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c
index 6b0a6df..b15d61b 100644
--- a/modules/video_output/msw/directx.c
+++ b/modules/video_output/msw/directx.c
@@ -1201,6 +1201,8 @@ static void DirectXDestroyPictureResource(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
+ if (sys->resource.p_sys->front_surface != sys->resource.p_sys->surface)
+ DirectXDestroySurface(sys->resource.p_sys->surface);
DirectXDestroySurface(sys->resource.p_sys->front_surface);
}
Re: libvlc 1.1.0 not freeing resources
Posted: 19 Jul 2010 20:46
by AEtH
What are you missing in the logs?? I have them just here, would you like me to post anything else? Anyway, I'm compiling now with the diff applied, let's see the results.
Thanks
Re: libvlc 1.1.0 not freeing resources
Posted: 19 Jul 2010 23:35
by fenrir
Nothing is missing from the logs you posted, I simply said that what you see (between 1.1 and 1.0) is expected. The code in 1.1 has been reworked, and some debug messages has been removed (in the code itself).
I will wait for you results.
Re: libvlc 1.1.0 not freeing resources
Posted: 20 Jul 2010 09:14
by AEtH
Well, these are the results from yesterday (without the patch). As expected, after 8 hours the player crashed (well, not crashed, just stopped showing anything)... but now I have more info. This is the log output of the crash:
Code: Select all
.
.
.
[GENERIC] [MAIN] ---------------> VoutDisplayEvent 'resize' 316x252 window
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_dst_clipped coords: 642,777,958,1014
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_src_clipped coords: 0,0,384,288
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_dst_clipped coords: 642,770,958,1022
[[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_src_clipped coords: 0,0,384,288
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_dst_clipped coords: 642,770,958,1022
[GENERIC] [DIRECTX] ------------> DirectXUpdateRects image_src_clipped coords: 0,0,384,288
[DECODER] [AVCODEC] ------------> using direct rendering
[DECODER] [MAIN] ---------------> End of video preroll
[VIDEO OUTPUT] [MAIN] ----------> Post-processing available
[VIDEO OUTPUT] [MAIN] ----------> vlc_object_find_name(postproc) is not safe!
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
[GENERIC] [DIRECTX] ------------> could not blit surface (error -2005532467)
.
.
.
Now I just started playing with the patch applied, maybe this work better.
Re: libvlc 1.1.0 not freeing resources
Posted: 20 Jul 2010 20:34
by AEtH
Right now the video is playing for 9 hours, I'll check again tomorrow, but I can say that the patch IS working. I changed your patch from
Code: Select all
if (sys->resource.p_sys->front_surface != sys->resource.p_sys->surface)
DirectXDestroySurface(sys->resource.p_sys->surface);
to
Code: Select all
if (sys->resource.p_sys->front_surface != sys->resource.p_sys->surface) {
DirectXDestroySurface(sys->resource.p_sys->surface);
msg_Dbg(vd, "Patch is working");
} else {
msg_Dbg(vd, "Patch is not working");
}
and the line
Patch is working appears in the logs. Let's see tomorrow!
Re: libvlc 1.1.0 not freeing resources
Posted: 20 Jul 2010 20:40
by Jean-Baptiste Kempf
be careful, messages may leak
Re: libvlc 1.1.0 not freeing resources
Posted: 21 Jul 2010 09:48
by AEtH
Well, the patch works ok but it did not solve the issue, after about 3500 iterations the player crashed as always. I'll take a deeper look at the code, let's see if I can see anything.
Re: libvlc 1.1.0 not freeing resources
Posted: 21 Jul 2010 12:39
by Jean-Baptiste Kempf
did you run it through gdb ?
Re: libvlc 1.1.0 not freeing resources
Posted: 21 Jul 2010 14:24
by AEtH
Not yet, I'm working with
directx.c. So far I detected a bug, is really strange. As you can see in this piece of code inside
Open:
Code: Select all
/* FIXME */
sys->use_overlay = false; //var_CreateGetBool(vd, "overlay");
/* FIXME */
overlay mode is broken. I uncommented that line and yes, it is broken. But, and this is strange, I saw in the logs this line:
Code: Select all
[GENERIC] [DIRECTX] ------------> YUV overlay surface created successfully
and again, that brought me to this code inside
DirectXCreatePictureResource:
Code: Select all
bool allow_overlay = var_InheritBool(vd, "overlay");
which should be
Code: Select all
bool allow_overlay = false; //var_InheritBool(vd, "overlay");
just while overlay mode is broken.
Right now I'm running a test with overlay disabled, let's see the results.
Re: libvlc 1.1.0 not freeing resources
Posted: 22 Jul 2010 00:35
by Jean-Baptiste Kempf
Btw, the patch is inside VLC 1.1.1 and libVLC 1.1.1 (just released).
Re: libvlc 1.1.0 not freeing resources
Posted: 22 Jul 2010 04:13
by AEtH
I printed
directx.c source code, both 1.0.6 and 1.1.1 versions. This is insane!!!
Well, let's dig out!!! (I somebody tells me that I'm not trying to solve the issue by myself, I could explode!
)
Re: libvlc 1.1.0 not freeing resources
Posted: 23 Jul 2010 11:39
by garlantinapple
the canvas handle is not released, and when the player starts playing again, another canvas handle is used.
Re: libvlc 1.1.0 not freeing resources
Posted: 23 Jul 2010 12:53
by Jean-Baptiste Kempf
canvas? on windows? You mean the HWND ?