[Live-devel] Crash for Http live Streaming

daniel dw at norpix.com
Thu Jun 14 12:51:32 PDT 2012


I'm working on HLS based on Live555.

I test mediaServer for HLS.it's crashed try to get a playlist.

The problem is in  the function
RTSPServerSupportingHTTPStreaming::RTSPClientSessionSupportingHTTPStreaming(
)
{
	.....
  fPlaylistSource = ByteStreamMemoryBufferSource::createNew(envir(),
(u_int8_t*)playlist, playlistLen);
  if (fTCPSink == NULL) fTCPSink = TCPStreamSink::createNew(envir(),
fClientOutputSocket);
  fTCPSink->startPlaying(*fPlaylistSource, afterStreaming, this);
}

fTCPSink->startPlaying(...) will call afterStreaming() when sending is done.

void
RTSPServerSupportingHTTPStreaming::RTSPClientSessionSupportingHTTPStreaming:
:afterStreaming(void* clientData) {
 
RTSPServerSupportingHTTPStreaming::RTSPClientSessionSupportingHTTPStreaming*
clientSession
    =
(RTSPServerSupportingHTTPStreaming::RTSPClientSessionSupportingHTTPStreaming
*)clientData;
   delete clientSession;
}

In the afterStreaming() function will delete himself.

RTSPServer::RTSPClientSession::handleRequestBytes(int newBytesRead) 
{
	...
	handleHTTPCmd_StreamingGET(urlSuffix, (char const*)fRequestBuffer);
	...
	/****Crash here **/
	/***Since this pointer is invalid this time. It has been delete in
handleHTTPCmd_StreamingGET(...)**/
		
    send(fClientOutputSocket, (char const*)fResponseBuffer,
strlen((char*)fResponseBuffer), 0);
    
    if (strcmp(cmdName, "SETUP") == 0 && fStreamAfterSETUP) {
      // The client has asked for streaming to commence now, rather than
after a
      // subsequent "PLAY" command.  So, simulate the effect of a "PLAY"
command:
      handleCmd_withinSession("PLAY", urlPreSuffix, urlSuffix, cseq,
			      (char const*)fRequestBuffer);
    }
    resetRequestBuffer(); // to prepare for any subsequent request
  } while (0);
}

Do you any idea? I use VS2010.

Thank very much.

Daniel





More information about the live-devel mailing list