Page 1 of 1

libvlc_media_player_set_media crashes

Posted: 10 Dec 2009 22:13
by MariP
I'm writing a simple frontend for the vlc. I'm working on C++/ Qt\2009.04 / MinGW / precompiled vlc-1.0.3-win32. Do you see any problems with this combination? (Building the vlc on mingw sounds a bit too complicated for me)

I have a problem with "eject" -functionality crashing randomly. Sometimes I can load and play videos tens of times. Sometimes loading the second or n'th video crashes without any exceptions. I have two classes: Gui and VideoEngine. Gui is a simple qt widget with a rendering area and button for opening new videos to play.

Vlc instance is created only once in VideoEngine constructor:

Code: Select all

VideoEngine::VideoEngine(QObject * parent) : QObject(parent) { const char * const vlc_args[] = { "-I", "dummy", "--ignore-config", "--extraintf=logger", "--verbose=2", "--plugin-path=C:\\vlc-1.0.3-win32\\vlc-1.0.3\\plugins" }; libvlc_exception_init(&_vlcexcep); _vlcinstance=libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args,&_vlcexcep); raise (&_vlcexcep); _mp = libvlc_media_player_new (_vlcinstance, &_vlcexcep); raise (&_vlcexcep); }
Each time new file is selected using eject-button and file browser in Gui -class, the initVideo -function of the VideoEngine is called.

Code: Select all

void VideoEngine::initVideo(WId windowId, QString fileName) { _m = libvlc_media_new (_vlcinstance, fileName.toAscii(), &_vlcexcep); raise(&_vlcexcep); libvlc_media_player_set_media (_mp, _m, &_vlcexcep); raise(&_vlcexcep); libvlc_media_release (_m); #if defined(Q_OS_WIN) libvlc_media_player_set_drawable(_mp, reinterpret_cast<unsigned int>(windowId), &_vlcexcep ); raise(&_vlcexcep); libvlc_media_player_play (_mp, &_vlcexcep ); raise(&_vlcexcep); }
Here's some output from one of the crashes on line raise(&_vlcexcep); or libvlc_media_player_set_media (_mp, _m, &_vlcexcep); Most probably the latter:

Code: Select all

[0xd7f0a14] main input debug: control type=0 [0xd7f0a14] main input debug: control: stopping input [0xd7a7074] main decoder debug: thread times: real 0m5.708208s, kernel 0m0.00000 0s, user 0m0.040057s [0xd7a7074] avcodec decoder debug: ffmpeg codec (Motion JPEG Video) stopped [0xd7a7074] main decoder debug: removing module "avcodec" [0xd7a7074] main decoder debug: killing decoder fourcc `MJPG', 0 PES in FIFO [0xd7e9354] main video output debug: [0] 4 0 [0xd7e9354] main video output debug: [1] 4 0 [0xd7e9354] main video output debug: [2] 4 0 [0xd7e9354] main video output debug: [3] 2 0 [0xd7e9354] main video output debug: [4] 2 0 [0xd7e9354] main video output debug: [5] 2 0 [0xd7e9354] main video output debug: [6] 0 0 [0xd7e9354] main video output debug: [7] 4 0 [0xd7e9354] main video output debug: [8] 2 0 [0xd7e9354] main video output debug: [9] 2 0 [0xd7e9354] main video output debug: [10] 2 0 [0xd7e9354] main video output debug: [11] 2 0 [0xd7e9354] main video output debug: [12] 2 0 [0xd7e9354] main video output debug: [13] 2 1 [0xd7e9354] main video output debug: [14] 4 0 [0xd7e9354] main video output debug: [15] 4 0 [0xd7f0a14] main input debug: saving a free vout [0xd87e77c] avi stream debug: free chunk avih [0xd87e77c] avi stream debug: free chunk strh [0xd87e77c] avi stream debug: free chunk strf [0xd87e77c] avi stream debug: free chunk LIST [0xd87e77c] avi stream debug: free chunk LIST [0xd87e77c] avi stream warning: unknown chunk (not unloaded) [0xd87e77c] avi stream warning: unknown chunk (not unloaded) [0xd87e77c] avi stream debug: free chunk LIST [0xd87e77c] avi stream debug: free chunk idx1 [0xd87e77c] avi stream debug: free chunk RIFF [0xd87e77c] avi stream debug: free chunk LIST [0xd87fee4] main demux debug: removing module "avi" [0xd87e77c] main stream debug: removing module "stream_filter_record" [0x164dcd94] main access debug: removing module "access_file" [0xd7f0a14] main input debug: Program doesn't contain anymore ES [0xd7f0a14] main input debug: thread ended [0xd7f0a14] main input debug: thread times: real 0m5.768294s, kernel 0m0.000000s , user 0m0.020028s [0xd7f0a14] main input debug: TIMER input launching for 'C:///Documents and Sett ings/Mari/Desktop/testvp/frame_num.avi' : 49.649 ms - Total 49.649 ms / 1 intvls (Avg 49.649 ms) [0xd815234] main chroma debug: removing module "swscale" [0xd7e9354] vout_directx video output debug: DirectXCloseSurface [0xd7e9354] vout_directx video output debug: DirectXCloseDisplay [0xd7e9354] vout_directx video output debug: DirectXCloseDisplay clipper [0xd7e9354] vout_directx video output debug: DirectXCloseDisplay display [0xd7e9354] vout_directx video output debug: DirectXCloseDDraw
Thanks
- Mari -

Re: libvlc_media_player_set_media crashes

Posted: 11 Dec 2009 08:57
by Jean-Baptiste Kempf
Do you have logs before that?

Re: libvlc_media_player_set_media crashes

Posted: 12 Dec 2009 14:08
by MariP
Yes, I have more of it but not all. What happens here is I'm playing and pausing a video. Then I'm trying to open it again but it crashes. In the log, there are some of my own debugging lines between but it should be readable.

Code: Select all

[0xd87e77c] main stream debug: looking for stream_filter module: 1 candidate [0xd87e77c] main stream debug: using stream_filter module "stream_filter_record" [0xd87e77c] main stream debug: TIMER module_need() : 0.296 ms - Total 0.296 ms / 1 intvls (Avg 0.296 ms) [0xd7f0a14] main input debug: creating demux: access='' demux='' path='C:/Docume nts and Settings/Mari/Desktop/testvp/frame_num.avi' [0xd87fee4] main demux debug: looking for demux module: 50 candidates [0xd87e77c] avi stream debug: found Chunk fourcc:46464952 (RIFF) size:137534656 pos:0 [0xd87e77c] avi stream debug: found LIST chunk: 'AVI ' [0xd87e77c] avi stream debug: <list 'AVI '> [0xd87e77c] avi stream debug: found Chunk fourcc:5453494c (LIST) size:220 pos:12 [0xd87e77c] avi stream debug: found LIST chunk: 'hdrl' [0xd87e77c] avi stream debug: <list 'hdrl'> [0xd87e77c] avi stream debug: found Chunk fourcc:68697661 (avih) size:56 pos:24 [0xd87e77c] avi stream debug: avih: streams:1 flags: HAS_INDEX 720x576 [0xd87e77c] avi stream debug: found Chunk fourcc:5453494c (LIST) size:144 pos:88 [0xd87e77c] avi stream debug: found LIST chunk: 'strl' [0xd87e77c] avi stream debug: <list 'strl'> [0xd87e77c] avi stream debug: found Chunk fourcc:68727473 (strh) size:56 pos:100 [0xd87e77c] avi stream debug: strh: type:vids handler:0x00000000 samplesize:0 25 .00fps [0xd87e77c] avi stream debug: found Chunk fourcc:66727473 (strf) size:68 pos:164 [0xd87e77c] avi stream debug: strf: video:MJPG 720x576 planes:1 24bpp [0xd87e77c] avi stream debug: </list 'strl'> [0xd87e77c] avi stream debug: </list 'hdrl'> [0xd87e77c] avi stream debug: found Chunk fourcc:416d7250 (PrmA) size:20 pos:240 [0xd87e77c] avi stream warning: unknown chunk (not loaded) [0xd87e77c] avi stream debug: found Chunk fourcc:514e554a (JUNQ) size:4484 pos:2 68 [0xd87e77c] avi stream warning: unknown chunk (not loaded) [0xd87e77c] avi stream debug: found Chunk fourcc:5453494c (LIST) size:137433872 pos:4760 [0xd87e77c] avi stream debug: skipping movi chunk [0xd87e77c] avi stream debug: found Chunk fourcc:31786469 (idx1) size:96016 pos: 137438640 [0xd87e77c] avi stream debug: idx1: index entry:6001 [0xd87e77c] avi stream debug: </list 'AVI '> [0xd87e77c] avi stream debug: * LIST-root size:137534664 pos:0 [0xd87e77c] avi stream debug: + RIFF-AVI size:137534656 pos:0 [0xd87e77c] avi stream debug: | + LIST-hdrl size:220 pos:12 [0xd87e77c] avi stream debug: | | + avih size:56 pos:24 [0xd87e77c] avi stream debug: | | + LIST-strl size:144 pos:88 [0xd87e77c] avi stream debug: | | | + strh size:56 pos:100 [0xd87e77c] avi stream debug: | | | + strf size:68 pos:164 [0xd87e77c] avi stream debug: | + PrmA size:20 pos:240 [0xd87e77c] avi stream debug: | + JUNQ size:4484 pos:268 [0xd87e77c] avi stream debug: | + LIST-movi size:137433872 pos:4760 [0xd87e77c] avi stream debug: | + idx1 size:96016 pos:137438640 [0xd87fee4] avi demux debug: AVIH: 1 stream, flags HAS_INDEX [0xd87fee4] avi demux debug: stream[0] rate:25 scale:1 samplesize:0 [0xd87fee4] avi demux debug: stream[0] video(MJPG) 720x576 24bpp 25.000000fps [0xd7f0a14] main input debug: selecting program id=0 [0xd87fee4] avi demux debug: stream[0] created 6001 index entries [0xd87fee4] avi demux debug: stream[0] length:240 (based on index) [0xd87fee4] main demux debug: using demux module "avi" [0xd87fee4] main demux debug: TIMER module_need() : 5.433 ms - Total 5.433 ms / 1 intvls (Avg 5.433 ms) [0xd7f0a14] main input debug: looking for a subtitle file in C:\Documents and Se ttings\Mari\Desktop\testvp\ [0xd7a7074] main decoder debug: looking for decoder module: 36 candidates [0xd7a7074] avcodec decoder debug: libavcodec already initialized [0xd7a7074] avcodec decoder debug: using direct rendering [0xd7a7074] avcodec decoder debug: ffmpeg codec (Motion JPEG Video) started [0xd7a7074] main decoder debug: using decoder module "avcodec" [0xd7a7074] main decoder debug: TIMER module_need() : 3.634 ms - Total 3.634 ms / 1 intvls (Avg 3.634 ms) [0xd7a7074] main decoder debug: thread (decoder) created at priority 0 (../.././ src/input/decoder.c:315) [0xd7f0a14] main input debug: thread (input) created at priority 1 (../.././src/ input/input.c:230) VideoEngine::raise() [0xd7a7074] main decoder debug: thread started [0xd7f0a14] main input debug: `C:/Documents and Settings/Mari/Desktop/testvp/fra me_num.avi' successfully opened [0xd7f0a14] main input debug: Buffering 0% [0xd7f0a14] main input debug: Buffering 8% [0xd7f0a14] main input debug: Buffering 16% [0xd7f0a14] main input debug: Buffering 25% [0xd7f0a14] main input debug: Buffering 33% [0xd7f0a14] main input debug: Buffering 41% [0xd7f0a14] main input debug: Buffering 50% [0xd7f0a14] main input debug: Buffering 58% [0xd7f0a14] main input debug: Buffering 66% [0xd7f0a14] main input debug: Buffering 75% [0xd7f0a14] main input debug: Buffering 83% [0xd7f0a14] main input debug: Buffering 91% [0xd7f0a14] main input debug: Buffering 100% [0xd7f0a14] main input debug: Stream buffering done (325 ms in 1 ms) [0xd7f0a14] main input debug: no usable vout present, spawning one [0xd764b94] main spu text debug: looking for text renderer module: 2 candidates VideoPlayerWidget::setState VideoPlayerWidget::enableDisablePlaying [0xd8614e4] main generic debug: thread (fontlist builder) created at priority 0 (../../.././modules/misc/freetype.c:475) [0xd764b94] freetype spu text debug: using fontsize: 2 [0xd8614e4] main generic debug: thread started [0xd8614e4] freetype generic debug: Building font database... [0xd764b94] main spu text debug: using text renderer module "freetype" [0xd764b94] main spu text debug: TIMER module_need() : 20.488 ms - Total 20.488 ms / 1 intvls (Avg 20.488 ms) [0xd87e834] main scale debug: looking for video filter2 module: 20 candidates [0xd87e834] swscale scale debug: 32x32 chroma: YUVA -> 16x16 chroma: YUVA with s caling using Bicubic (good quality) [0xd87e834] main scale debug: using video filter2 module "swscale" [0xd8614e4] freetype generic debug: Finished building font database. [0xd8614e4] freetype generic debug: Took 104 microseconds [0xd8614e4] main generic debug: thread ended [0xd87e834] main scale debug: TIMER module_need() : 5.592 ms - Total 5.592 ms / 1 intvls (Avg 5.592 ms) [0x164d1074] main scale debug: looking for video filter2 module: 20 candidates [0x164d1074] yuvp scale debug: YUVP to YUVA converter [0x164d1074] main scale debug: using video filter2 module "yuvp" [0x164d1074] main scale debug: TIMER module_need() : 1.599 ms - Total 1.599 ms / 1 intvls (Avg 1.599 ms) [0xd7e9354] main video output debug: window size: 720x576 [0xd7e9354] main video output debug: looking for video output module: 7 candidat es [0xd7e9354] vout_directx video output debug: creating DirectXEventThread [0xd8045fc] main generic debug: thread (Vout Events Thread) created at priority 0 (../../../.././modules/video_output/msw/directx.c:282) [0xd8045fc] main generic debug: thread started [0xd7e9354] vout_directx video output debug: DirectXCreateWindow [0x1653a054] main window debug: looking for hwnd module: 3 candidates [0x1653a054] main window debug: using hwnd module "drawable" [0x1653a054] main window debug: TIMER module_need() : 3.503 ms - Total 3.503 ms / 1 intvls (Avg 3.503 ms) [0xd7e9354] vout_directx video output debug: created video sub-window [0xd7e9354] vout_directx video output debug: Vout EventThread running [0xd7e9354] vout_directx video output debug: DirectXInitDDraw [0xd7e9354] vout_directx video output debug: directx-device: [0xd7e9354] vout_directx video output debug: DirectXEnumCallback: Primary Displa y Driver, display [0xd7e9354] vout_directx video output debug: DirectXEnumCallback: MOBILITY RADEO N 9200, \\.\DISPLAY1 [0xd7e9354] vout_directx video output debug: selecting MOBILITY RADEON 9200, \\. \DISPLAY1 [0xd7e9354] vout_directx video output debug: screen dimensions (0x0,1680x1050) [0xd7e9354] vout_directx video output debug: DirectDraw Capabilities: overlay=1 yuvoverlay=1 can_deinterlace_overlay=1 colorkey=1 stretch=1 bltfourcc=1 [0xd7e9354] vout_directx video output debug: End DirectXInitDDraw [0xd7e9354] vout_directx video output debug: DirectXCreateDisplay [0xd7e9354] vout_directx video output debug: DirectXCreateClipper [0xd7e9354] vout_directx video output debug: disabling screen saver [0xd7e9354] main video output debug: using video output module "vout_directx" [0xd7e9354] main video output debug: TIMER module_need() : 29.422 ms - Total 29. 422 ms / 1 intvls (Avg 29.422 ms) [0xd7e9354] main video output debug: Deinterlacing available [0xd7e9354] vout_directx video output debug: NewPictureVec overlay:yes chroma:YV 12 [0xd7e9354] vout_directx video output warning: DirectDrawUpdateOverlay cannot mo ve/resize overlay [0xd7e9354] vout_directx video output error: overlay unuseable (might already be in use) [0xd7e9354] vout_directx video output warning: DirectDrawUpdateOverlay cannot mo ve/resize overlay [0xd7e9354] vout_directx video output error: overlay unuseable (might already be in use) [0xd7e9354] vout_directx video output debug: End NewPictureVec (failed) [0xd7e9354] vout_directx video output debug: NewPictureVec overlay:yes chroma:YV 12 [0xd7e9354] vout_directx video output warning: DirectDrawUpdateOverlay cannot mo ve/resize overlay [0xd7e9354] vout_directx video output error: overlay unuseable (might already be in use) [0xd7e9354] vout_directx video output warning: DirectDrawUpdateOverlay cannot mo ve/resize overlay [0xd7e9354] vout_directx video output error: overlay unuseable (might already be in use) [0xd7e9354] vout_directx video output debug: End NewPictureVec (failed) [0xd7e9354] vout_directx video output debug: NewPictureVec overlay:yes chroma:YU Y2 [0xd7e9354] vout_directx video output warning: DirectDrawUpdateOverlay cannot mo ve/resize overlay [0xd7e9354] vout_directx video output error: overlay unuseable (might already be in use) [0xd7e9354] vout_directx video output warning: DirectDrawUpdateOverlay cannot mo ve/resize overlay [0xd7e9354] vout_directx video output error: overlay unuseable (might already be in use) [0xd7e9354] vout_directx video output debug: End NewPictureVec (failed) [0xd7e9354] vout_directx video output warning: Could not initialize directx over lay [0xd7e9354] vout_directx video output debug: NewPictureVec overlay:no chroma:YV1 2 [0xd7e9354] vout_directx video output debug: created plain surface of chroma:YV1 2 [0xd7e9354] vout_directx video output debug: End NewPictureVec (succeeded) [0xd7e9354] main video output debug: got 1 direct buffer(s) [0xd7e9354] main video output debug: pic render sz 720x576, of (0,0), vsz 720x57 6, 4cc J422, ar 5:4, sar 1:1, msk r0x0 g0x0 b0x0 [0xd7e9354] main video output debug: pic in sz 720x576, of (0,0), vsz 720x576, 4 cc J422, ar 5:4, sar 1:1, msk r0x0 g0x0 b0x0 [0xd7e9354] main video output debug: pic out sz 720x576, of (0,0), vsz 720x576, 4cc I420, ar 5:4, sar 1:1, msk r0x0 g0x0 b0x0 [0xd815234] main chroma debug: looking for video filter2 module: 20 candidates [0xd815234] swscale chroma debug: 720x576 chroma: J422 -> 720x576 chroma: I420 w ith scaling using Bicubic (good quality) [0xd815234] main chroma debug: using video filter2 module "swscale" [0xd815234] main chroma debug: TIMER module_need() : 2.129 ms - Total 2.129 ms / 1 intvls (Avg 2.129 ms) [0xd7e9354] main video output debug: indirect render, mapping render pictures 0- 15 to system pictures 1-16 [0xd7a7074] main decoder debug: End of video preroll [0xd7a7074] main decoder debug: Received first picture [0xd7f0a14] main input debug: Decoder buffering done in 111 ms [0xd7e9354] main video output debug: Post-processing available [0xd764b94] freetype spu text debug: using fontsize: 36 [0x1652cebc] main blend debug: looking for video blending module: 1 candidate [0x1652cebc] blend blend debug: chroma: YUVA -> I420 [0x1652cebc] main blend debug: using video blending module "blend" [0x1652cebc] main blend debug: TIMER module_need() : 0.396 ms - Total 0.396 ms / 1 intvls (Avg 0.396 ms) [0xd7e9354] main video output warning: late picture skipped (93200 > -6280) [0xd7e9354] main video output warning: late picture skipped (13200 > -6280) [0xd7e9354] main video output warning: late picture skipped (53200 > -6280) VideoEngine::playOrPause() [0xd7f0a14] main input debug: control type=1 VideoEngine::raise() VideoEngine::playOrPause() [0xd7f0a14] main input debug: control type=1 VideoEngine::raise() VideoEngine::playOrPause() [0xd7f0a14] main input debug: control type=1 VideoEngine::raise() VideoEngine::initVideo(WId windowId, QString fileName) VideoEngine::raise() [0xd7f0a14] main input debug: control type=0 [0xd7f0a14] main input debug: control: stopping input [0xd7a7074] main decoder debug: thread times: real 0m5.708208s, kernel 0m0.00000 0s, user 0m0.040057s [0xd7a7074] avcodec decoder debug: ffmpeg codec (Motion JPEG Video) stopped [0xd7a7074] main decoder debug: removing module "avcodec" [0xd7a7074] main decoder debug: killing decoder fourcc `MJPG', 0 PES in FIFO [0xd7e9354] main video output debug: [0] 4 0 [0xd7e9354] main video output debug: [1] 4 0 [0xd7e9354] main video output debug: [2] 4 0 [0xd7e9354] main video output debug: [3] 2 0 [0xd7e9354] main video output debug: [4] 2 0 [0xd7e9354] main video output debug: [5] 2 0 [0xd7e9354] main video output debug: [6] 0 0 [0xd7e9354] main video output debug: [7] 4 0 [0xd7e9354] main video output debug: [8] 2 0 [0xd7e9354] main video output debug: [9] 2 0 [0xd7e9354] main video output debug: [10] 2 0 [0xd7e9354] main video output debug: [11] 2 0 [0xd7e9354] main video output debug: [12] 2 0 [0xd7e9354] main video output debug: [13] 2 1 [0xd7e9354] main video output debug: [14] 4 0 [0xd7e9354] main video output debug: [15] 4 0 [0xd7f0a14] main input debug: saving a free vout [0xd87e77c] avi stream debug: free chunk avih [0xd87e77c] avi stream debug: free chunk strh [0xd87e77c] avi stream debug: free chunk strf [0xd87e77c] avi stream debug: free chunk LIST [0xd87e77c] avi stream debug: free chunk LIST [0xd87e77c] avi stream warning: unknown chunk (not unloaded) [0xd87e77c] avi stream warning: unknown chunk (not unloaded) [0xd87e77c] avi stream debug: free chunk LIST [0xd87e77c] avi stream debug: free chunk idx1 [0xd87e77c] avi stream debug: free chunk RIFF [0xd87e77c] avi stream debug: free chunk LIST [0xd87fee4] main demux debug: removing module "avi" [0xd87e77c] main stream debug: removing module "stream_filter_record" [0x164dcd94] main access debug: removing module "access_file" [0xd7f0a14] main input debug: Program doesn't contain anymore ES [0xd7f0a14] main input debug: thread ended [0xd7f0a14] main input debug: thread times: real 0m5.768294s, kernel 0m0.000000s , user 0m0.020028s [0xd7f0a14] main input debug: TIMER input launching for 'C:///Documents and Sett ings/Mari/Desktop/testvp/frame_num.avi' : 49.649 ms - Total 49.649 ms / 1 intvls (Avg 49.649 ms) [0xd815234] main chroma debug: removing module "swscale" [0xd7e9354] vout_directx video output debug: DirectXCloseSurface [0xd7e9354] vout_directx video output debug: DirectXCloseDisplay [0xd7e9354] vout_directx video output debug: DirectXCloseDisplay clipper [0xd7e9354] vout_directx video output debug: DirectXCloseDisplay display [0xd7e9354] vout_directx video output debug: DirectXCloseDDraw
- Mari -

Re: libvlc_media_player_set_media crashes

Posted: 24 Jan 2010 14:11
by MariP
I think the crash is caused by Qt layout and the widget in which I'm rendering. If I'm rendering the video to a widget that is defined to stretch, it will crash when loading a new video. If I understood why stretching layout causes a crash I could possibly fix it.

For example this layout will crash

Code: Select all

QVBoxLayout * layout = new QVBoxLayout(); layout->addWidget(new QLabel("Video title")); layout->addWidget(new QFrame()); //video frame layout->addWidget(new QPushButton("Play")); layout->setStretch(1,1); //this will make only the video rendering area stretch
This layout never crashes but is not very user friendly because all the widgets will stretch.

Code: Select all

QVBoxLayout * layout = new QVBoxLayout(); layout->addWidget(new QLabel("Video title")); layout->addWidget(new QFrame()); //video frame layout->addWidget(new QPushButton("Play"));

Re: libvlc_media_player_set_media crashes

Posted: 29 Jan 2010 07:52
by kryptonite
Did you figure out a fix?

Thanks.