imem lock and rtsp help

This forum is about all development around libVLC.
mirswith
Blank Cone
Blank Cone
Posts: 49
Joined: 15 Dec 2011 01:15

imem lock and rtsp help

Postby mirswith » 26 Jan 2012 02:41

Hi. I've got two issues I am hoping someone can help me with. I am using the imem functionality to encode and stream over rtsp, or at least that is what I plan to do. :) I am up and running, not yet filling in the buffer in the callback (just nulling it and setting size to 0 for now) but the callbacks are being called. The first problem I am having is that when I call libvlc_media_player_stop the app hangs and I am unable to get any debug information and have to kill the process to continue. The second issue is more a question, what do I need to change to get my image to be encoded to h264 and served up as an rtsp stream? Here is my function that initializes and starts the stream:

Code: Select all

std::string argStr; argStr += " --imem-get=" + StringUtil::fromPtr(imemGetCb); argStr += " --imem-release=" + StringUtil::fromPtr(imemReleaseCb); argStr += " --imem-data=" + StringUtil::fromPtr(_data); argStr += " --imem-width=" + StringUtil::fromInt(width); argStr += " --imem-height=" + StringUtil::fromInt(height); argStr += " -vvv"; argStr += " --verbose=2"; argStr += " --imem-id=1"; argStr += " --imem-group=1"; argStr += " --imem-cat=2"; argStr += " --imem-codec=RV32"; char ** args = NULL; int argCount = StringUtil::stringToArgs(argStr,&args); DATA.vlc.instance = libvlc_new(argCount, args); StringUtil::freeArgs(&args, argCount); debug(DBG_INFO, "vlc server instance: %p", DATA.vlc.instance); if( !DATA.vlc.instance ) return false; std::string outputMrl = "#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}"; outputMrl += ":rtp{sdp=rtsp://0.0.0.0:" + StringUtil::fromInt(port) + "/}"; int result = libvlc_vlm_add_broadcast(DATA.vlc.instance, "test", "imem://", outputMrl.c_str(), 0, // option count NULL, // options TRUE, // enabled FALSE); // loop if( result!=0 ) { destroy(); return false; } DATA.vlc.media = libvlc_media_new_location(DATA.vlc.instance, "imem://"); if( !DATA.vlc.media ) { destroy(); return false; } DATA.vlc.player = libvlc_media_player_new_from_media(DATA.vlc.media); if( !DATA.vlc.player ) { destroy(); return false; } // start playing/serving libvlc_media_player_play(DATA.vlc.player); //libvlc_vlm_play_media(DATA.vlc.instance, "test");
Later when this class is destroyed I call stop on the player which hangs.

Here is the vlc output:

Code: Select all

VLC media player - 1.3.0-git Rincewind Copyright © 1996-2012 the VideoLAN team revision 1.3.0-git-583-g0c0c1a0 configured with ../extras/package/win32/../../../configure '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-quicktime' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-x264' '--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--disable-portaudio' '--disable-sdl' '--enable-qt4' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-sqlite' '--disable-dirac' '--host=i586-mingw32msvc' 'host_alias=i586-mingw32msvc' searching plug-in modules loading plugins cache file ....blah\debug\plugins\plugins.dat recursively browsing `....blah\debug\plugins' saving plugins cache ....blah\debug\plugins\plugins.dat plug-ins loaded: 396 modules translation test: code is "C" CPU has capabilities MMX 3DNow! MMXEXT SSE SSE2 SSE3 FPU looking for memcpy module: 4 candidates using memcpy module "memcpymmxext" looking for interface module: 1 candidate using interface module "hotkeys" Creating an input for 'imem://' using timeshift granularity of 50 MiB, in path '....blah\Temp' `imem://' gives access `imem' demux `' path `' creating demux: access='imem' demux='' location='' file='(null)' looking for access_demux module: 1 candidate Using get(0xfb98040), release(0xfb98060), data(0x10b81a0), cookie((null)) Video RV32 640x480 SAR 0:0 frame rate 0/0 selecting program id=1 using access_demux module "access_imem" looking for decoder module: 33 candidates invalid frame rate 0/0, using 25 fps instead using decoder module "rawvideo" looking for meta reader module: 2 candidates Trying Lua scripts in ....blah\vlc\lua\meta\reader no meta reader module matching "any" could be loaded `imem://' successfully opened
I appreciate any help.. Thanks!

mirswith
Blank Cone
Blank Cone
Posts: 49
Joined: 15 Dec 2011 01:15

Re: imem lock and rtsp help

Postby mirswith » 26 Jan 2012 21:35

Ok, I feel I am getting a little closer but am not quite there yet. I've removed the add broadcast call and changed my input options to the vlc instance as follows:

Code: Select all

std::string argStr; argStr += " --imem-get=" + StringUtil::fromPtr(imemGetCb); argStr += " --imem-release=" + StringUtil::fromPtr(imemReleaseCb); argStr += " --imem-data=" + StringUtil::fromPtr(_data); argStr += " --imem-width=" + StringUtil::fromInt(width); argStr += " --imem-height=" + StringUtil::fromInt(height); argStr += " --imem-fps=12"; argStr += " -vvv"; argStr += " --verbose=2"; argStr += " --imem-id=1"; argStr += " --imem-group=1"; argStr += " --imem-cat=2"; argStr += " --imem-codec=RV32"; argStr += " --sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:rtp{sdp=rtsp://:" + StringUtil::fromInt(port) + "/}"; argStr += " --no-sout-rtp-sap"; argStr += " --no-sout-standard-sap"; argStr += " --ttl=1"; argStr += " --sout-keep";
I also am giving it a valid buffer in the get callback. Now vlc dumps this out over and over:

Code: Select all

... Buffering 0% Buffering 0% Buffering 0% Buffering 0% decoder/packetizer fifo full (data not consumed quickly enough), resetting fifo! Buffering 0% Buffering 0% Buffering 0% Buffering 0% ...
I try then to connect to the server using an instance of vlc from my mac and it gives me this error log:

Code: Select all

main debug: processing request item rtsp://192.168.88.2:5544/ node Playlist skip 0 main debug: resyncing on rtsp://192.168.88.2:5544/ main debug: rtsp://192.168.88.2:5544/ is at 0 main debug: starting new item main debug: creating new input thread main debug: Creating an input for 'rtsp://192.168.88.2:5544/' main debug: thread (input) created at priority 22 (../../src/input/input.c:220) main debug: thread started main debug: using timeshift granularity of 50 MiB main debug: using timeshift path '/tmp' main debug: `rtsp://192.168.88.2:5544/' gives access `rtsp' demux `' path `192.168.88.2:5544/' main debug: creating demux: access='rtsp' demux='' path='192.168.88.2:5544/' main debug: looking for access_demux module: 1 candidate macosx debug: input has changed, refreshing interface live555 debug: DESCRIBE failed with 0: 500 Internal server error live555 debug: connection timeout live555 error: Failed to connect with rtsp://192.168.88.2:5544/ main debug: no access_demux module matching "rtsp" could be loaded main debug: TIMER module_need() : 62.233 ms - Total 62.233 ms / 1 intvls (Avg 62.233 ms) main debug: creating access 'rtsp' path='192.168.88.2:5544/' main debug: looking for access module: 1 candidate main debug: net: connecting to 192.168.88.2 port 5544 main debug: connection succeeded (socket = 17) access_realrtsp debug: rtsp connected access_realrtsp warning: only real/helix rtsp servers supported for now main debug: no access module matching "rtsp" could be loaded main debug: TIMER module_need() : 195.721 ms - Total 195.721 ms / 1 intvls (Avg 195.721 ms) main debug: waitpipe: object killed main error: open of `rtsp://192.168.88.2:5544/' failed: (null) main debug: finished input main debug: dead input main debug: thread ended main debug: changing item without a request (current 0/1) main debug: nothing to play macosx debug: input has stopped, refreshing interface main debug: TIMER input launching for 'rtsp://192.168.88.2:5544/' : 292.059 ms - Total 292.059 ms / 1 intvls (Avg 292.059 ms)
It seems it connects but then fails. Also now when I try to close down the pipeline it still hangs spitting out the "Buffering 0%" message and again I have to kill the process. Any ideas?

Thanks!

mirswith
Blank Cone
Blank Cone
Posts: 49
Joined: 15 Dec 2011 01:15

Re: imem lock and rtsp help

Postby mirswith » 26 Jan 2012 21:59

Ok, I solved my issue.. it helps when you satisfy the get callback completely, I was not setting the time stamps which caused these issues. All working good now! :D Thanks libVlc!

dxball
New Cone
New Cone
Posts: 9
Joined: 09 Aug 2012 09:35
VLC version: 2.0.3
Operating System: Windows

Re: imem lock and rtsp help

Postby dxball » 01 Oct 2012 09:39

Ok, I solved my issue.. it helps when you satisfy the get callback completely, I was not setting the time stamps which caused these issues. All working good now! :D Thanks libVlc!
HI mirswith.

i'm developing an application using memory input module (imem)
after googling...i found this topic
now i can display the image from imem module, but when i call "libvlc_media_player_stop", the application hangs, just like what you post
how do you solve this problem.

any advice will be appreciated. thx!

ihata
New Cone
New Cone
Posts: 1
Joined: 05 Apr 2013 08:43

Re: imem lock and rtsp help

Postby ihata » 05 Apr 2013 08:46

Ok, I solved my issue.. it helps when you satisfy the get callback completely, I was not setting the time stamps which caused these issues. All working good now! :D Thanks libVlc!
Can you provide a code snippet for setting timestamps? I'm stuck at this dts-pts stuff.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 9 guests