[Live-devel] live555proxy as dll library. System.AccessViolationException when server closing

Сергей Бастраков shaman.lab.x11 at gmail.com
Wed Nov 28 06:41:03 PST 2012


I tried to solve the problem, and got the following results (I have dll
library with live555 code and host application that used this library):
- I have no media sessions, launch and run empty server. Start and stop are
OK. Media::close(rtspServer) runs with no errors. Next server starts also
OK.
- I have one or more media sessions (from camera stream). First launch is
OK. Players (vlc for example) are connected to proxy and played
successfully. If we have no clients and try call Medium::close for rtsp
server, there is exception in RTCP.cpp:240 (2012.11.22 version). Callstack:
"live555proxyDLLNative.dll!RTCPInstance::setByeHandler(void (void *)*
handlerTask, void * clientData, bool handleActiveParticipantsOnly)  Line
240 + 0x6 bytes C++
  live555proxyDLLNative.dll!ProxyServerMediaSubsession::~ProxyServerMediaSubsession()
 Line 342 C++
  live555proxyDLLNative.dll!ProxyServerMediaSubsession::`scalar deleting
destructor'()  + 0xf bytes C++
  live555proxyDLLNative.dll!MediaLookupTable::remove(const char * name)
 Line 152 + 0x21 bytes C++
  live555proxyDLLNative.dll!Medium::close(UsageEnvironment & env, const
char * name)  Line 54 C++
  live555proxyDLLNative.dll!Medium::close(Medium * medium)  Line 59 + 0x17
bytes C++
  live555proxyDLLNative.dll!ServerMediaSession::deleteAllSubsessions()
 Line 195 + 0xc bytes C++
  live555proxyDLLNative.dll!ServerMediaSession::~ServerMediaSession()  Line
84 C++
  live555proxyDLLNative.dll!ProxyServerMediaSession::~ProxyServerMediaSession()
 Line 93 + 0xf bytes C++
  live555proxyDLLNative.dll!ProxyServerMediaSession::`scalar deleting
destructor'()  + 0xf bytes C++
  live555proxyDLLNative.dll!MediaLookupTable::remove(const char * name)
 Line 152 + 0x21 bytes C++
  live555proxyDLLNative.dll!Medium::close(UsageEnvironment & env, const
char * name)  Line 54 C++
  live555proxyDLLNative.dll!Medium::close(Medium * medium)  Line 59 + 0x17
bytes C++
  live555proxyDLLNative.dll!RTSPServer::removeServerMediaSession(ServerMediaSession
* serverMediaSession)  Line 74 + 0x9 bytes C++
  live555proxyDLLNative.dll!RTSPServer::~RTSPServer()  Line 260 C++
  live555proxyDLLNative.dll!RTSPServer::`scalar deleting destructor'()  +
0xf bytes C++
  live555proxyDLLNative.dll!MediaLookupTable::remove(const char * name)
 Line 152 + 0x21 bytes C++
  live555proxyDLLNative.dll!Medium::close(UsageEnvironment & env, const
char * name)  Line 54 C++
  live555proxyDLLNative.dll!Medium::close(Medium * medium)  Line 59 + 0x17
bytes C++
  live555proxyDLLNative.dll!DoLoop()  Line 50 + 0xc bytes C++"

If we have clients and try call Medium::close for rtsp server, there is
exception in RTSPClient.cpp:1205 (2012.11.22 version). Callstack:

 "live555proxyDLLNative.dll!RTSPClient::handleAlternativeRequestByte1(unsigned
char requestByte)  Line 1205 + 0x27 bytes C++
  live555proxyDLLNative.dll!RTSPClient::handleAlternativeRequestByte(void *
rtspClient, unsigned char requestByte)  Line 1196 C++
  live555proxyDLLNative.dll!SocketDescriptor::~SocketDescriptor()  Line 348
+ 0x14 bytes C++
  live555proxyDLLNative.dll!SocketDescriptor::`scalar deleting
destructor'()  + 0xf bytes C++
  live555proxyDLLNative.dll!SocketDescriptor::deregisterRTPInterface(unsigned
char streamChannelId)  Line 391 + 0x20 bytes C++
  live555proxyDLLNative.dll!deregisterSocket(UsageEnvironment & env, int
sockNum, unsigned char streamChannelId)  Line 159 C++
  live555proxyDLLNative.dll!RTPInterface::stopNetworkReading()  Line 274 +
0x1d bytes C++
  live555proxyDLLNative.dll!RTCPInstance::~RTCPInstance()  Line 185 C++
  live555proxyDLLNative.dll!RTCPInstance::`scalar deleting destructor'()  +
0xf bytes C++
  live555proxyDLLNative.dll!MediaLookupTable::remove(const char * name)
 Line 152 + 0x21 bytes C++
  live555proxyDLLNative.dll!Medium::close(UsageEnvironment & env, const
char * name)  Line 54 C++
  live555proxyDLLNative.dll!Medium::close(Medium * medium)  Line 59 + 0x17
bytes C++
  live555proxyDLLNative.dll!MediaSubsession::deInitiate()  Line 807 + 0xf
bytes C++
  live555proxyDLLNative.dll!MediaSubsession::~MediaSubsession()  Line 602
C++
  live555proxyDLLNative.dll!MediaSubsession::`scalar deleting destructor'()
 + 0xf bytes C++
  live555proxyDLLNative.dll!MediaSession::~MediaSession()  Line 82 + 0x23
bytes C++
  live555proxyDLLNative.dll!MediaSession::`scalar deleting destructor'()  +
0xf bytes C++
  live555proxyDLLNative.dll!MediaLookupTable::remove(const char * name)
 Line 152 + 0x21 bytes C++
  live555proxyDLLNative.dll!Medium::close(UsageEnvironment & env, const
char * name)  Line 54 C++
  live555proxyDLLNative.dll!Medium::close(Medium * medium)  Line 59 + 0x17
bytes C++
  live555proxyDLLNative.dll!ProxyServerMediaSession::~ProxyServerMediaSession()
 Line 91 + 0xc bytes C++
  live555proxyDLLNative.dll!ProxyServerMediaSession::`scalar deleting
destructor'()  + 0xf bytes C++
  live555proxyDLLNative.dll!MediaLookupTable::remove(const char * name)
 Line 152 + 0x21 bytes C++
  live555proxyDLLNative.dll!Medium::close(UsageEnvironment & env, const
char * name)  Line 54 C++
  live555proxyDLLNative.dll!Medium::close(Medium * medium)  Line 59 + 0x17
bytes C++
  live555proxyDLLNative.dll!RTSPServer::removeServerMediaSession(ServerMediaSession
* serverMediaSession)  Line 74 + 0x9 bytes C++
  live555proxyDLLNative.dll!RTSPServer::~RTSPServer()  Line 260 C++
  live555proxyDLLNative.dll!RTSPServer::`scalar deleting destructor'()  +
0xf bytes C++
  live555proxyDLLNative.dll!MediaLookupTable::remove(const char * name)
 Line 152 + 0x21 bytes C++
  live555proxyDLLNative.dll!Medium::close(UsageEnvironment & env, const
char * name)  Line 54 C++
  live555proxyDLLNative.dll!Medium::close(Medium * medium)  Line 59 + 0x17
bytes C++
  live555proxyDLLNative.dll!DoLoop()  Line 50 + 0xc bytes C++"

I was mistaken in this thread
http://lists.live555.com/pipermail/live-devel/2012-November/016105.html.
Problem is saved here.
Library source: http://pastebin.com/FKrFX1wa


2012/11/28 Сергей Бастраков <shaman.lab.x11 at gmail.com>

> This parts of code are in different functions.
> "env->taskScheduler().doEventLoop(&done);" called in dll's function in
> other thread,  "done = ~0; is in stop function. With doEventLoop return I
> have no problem.
> 28.11.2012 5:47 пользователь "Ross Finlayson" <finlayson at live555.com>
> написал:
>
>> "if (env!=NULL)
>> env->taskScheduler().doEventLoop(&done);"
>> "done = ~0;
>>
>>
>> The "doEventLoop()" function does not return *until* the variable "done"
>> is set to some non-zero value, so if the value of "done" is zero before you
>> call "doEventLoop()", then that call will never return (and so you will
>> never get to the statement "done = ~0;").
>>
>> If you want to leave the event loop (using this method), then you will
>> need to set "done = ~0;" either
>> - within the event loop (i.e., when you handle a LIVE555 event), or
>>  - from a different thread.
>>
>>
>> Ross Finlayson
>> Live Networks, Inc.
>> http://www.live555.com/
>>
>>
>> _______________________________________________
>> live-devel mailing list
>> live-devel at lists.live555.com
>> http://lists.live555.com/mailman/listinfo/live-devel
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20121128/d89efbb1/attachment-0001.html>


More information about the live-devel mailing list