[Live-devel] streaming AC3 over RTP using LIve555

Ashwani Kathuria ashwani.grps at gmail.com
Wed Mar 23 03:23:07 PDT 2011


Hi,

I am trying to stream AC3 audio format file using Live555.
For that I have implemented a new class AC3AudioFileServerMediaSubsession.

However if I compile the code without NODEBUG=1 flag than the server
crashes with stack trace mentioned below in mail.

With NODEBG=1 flag nothing happens at server and no packets are shown
on network.

Please suggest if I am doing somethijg wrong here?

The enclosures are:
1. AC3AudioFileServerMediaSubsession.hh
2. AC3AudioFileServerMediaSubsession.cpp
3. stack traces of crashes
4. Debug traces at server
5. Changes in testOnDemandRTSPServer.cpp for AC3

Regards,
Ashwani Kathuria

---------------------------------------------------------------------------------------------------------------------------------------
1. -- AC3AudioFileServerMediaSubsession.hh
------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
class AC3AudioFileServerMediaSubsession: public FileServerMediaSubsession{
public:
  static AC3AudioFileServerMediaSubsession*
  createNew(UsageEnvironment& env, char const* fileName, Boolean
reuseFirstSource);

private:
  AC3AudioFileServerMediaSubsession(UsageEnvironment& env,
				      char const* fileName, Boolean reuseFirstSource);
      // called only by createNew();
  virtual ~AC3AudioFileServerMediaSubsession();

private: // redefined virtual functions
  virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
					      unsigned& estBitrate);
  virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock,
                                    unsigned char rtpPayloadTypeIfDynamic,
				    FramedSource* inputSource);
};

---------------------------------------------------------------------------------------------------------------------------------------
2. ----------AC3AudioFileServerMediaSubsession.cpp
------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
AC3AudioFileServerMediaSubsession*
AC3AudioFileServerMediaSubsession::createNew(UsageEnvironment& env,
					     char const* fileName,
					     Boolean reuseFirstSource) {
  return new AC3AudioFileServerMediaSubsession(env, fileName, reuseFirstSource);
}

AC3AudioFileServerMediaSubsession
::AC3AudioFileServerMediaSubsession(UsageEnvironment& env,
				    char const* fileName, Boolean reuseFirstSource)
  : FileServerMediaSubsession(env, fileName, reuseFirstSource) {
}

AC3AudioFileServerMediaSubsession
::~AC3AudioFileServerMediaSubsession() {
}


FramedSource* AC3AudioFileServerMediaSubsession
::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate)
{
	estBitrate = 48; // kbps, estimate

	ByteStreamFileSource* fSource
		= ByteStreamFileSource::createNew(envir(), fFileName);
	AC3AudioStreamFramer* source
		= AC3AudioStreamFramer::createNew(envir(),fSource);	

	return source;
}


RTPSink* AC3AudioFileServerMediaSubsession
::createNewRTPSink(Groupsock* rtpGroupsock,
		   unsigned char rtpPayloadTypeIfDynamic,
		   FramedSource* inputSource)
{
  AC3AudioStreamFramer* audioSource = (AC3AudioStreamFramer*)inputSource;
  return AC3AudioRTPSink::createNew(envir(), rtpGroupsock,
				    rtpPayloadTypeIfDynamic,
				    audioSource->samplingRate());
}
---------------------------------------------------------------------------------------------------------------------------------------
3. Crash stack Traces
---------------------------------------------------------------------------------------------------------------------------------------
However if I compile the code without NODEBUG=1 flag than the server
crashes with following stack trace:
irst chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=feeefeee ebx=00000000 ecx=feeefeee edx=024c98e8 esi=00000000 edi=00000000
eip=00405c5a esp=0012eca8 ebp=0012ecac iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
*** WARNING: Unable to verify checksum for testOnDemandRTSPServer.exe
testOnDemandRTSPServer!Medium::envir+0xa:
00405c5a 8b4004          mov     eax,dword ptr [eax+4] ds:0023:feeefef2=????????
0:000> kp
ChildEBP RetAddr
0012ecac 0040a468 testOnDemandRTSPServer!Medium::envir(void)+0xa
[e:\officialdata\rtp\live\live-latest\livemedia\include\media.hh @ 59]
0012f3bc 00409feb
testOnDemandRTSPServer!AC3AudioStreamParser::parseFrame(unsigned int *
numTruncatedBytes = 0x024c97e0)+0x1b8
[e:\officialdata\rtp\live\live-latest\livemedia\ac3audiostreamframer.cpp
@ 306]
0012f3d8 00409ed8
testOnDemandRTSPServer!AC3AudioStreamFramer::parseNextFrame(void)+0x1b
[e:\officialdata\rtp\live\live-latest\livemedia\ac3audiostreamframer.cpp
@ 165]
0012f3e4 004131d1
testOnDemandRTSPServer!AC3AudioStreamFramer::doGetNextFrame(void)+0x28
[e:\officialdata\rtp\live\live-latest\livemedia\ac3audiostreamframer.cpp
@ 126]
0012f400 00414375
testOnDemandRTSPServer!FramedSource::getNextFrame(unsigned char * to =
0x024ba516 "--- memory read error at address 0x024ba516 ---", unsigned
int maxSize = 0xed82, <function> * afterGettingFunc = 0x00414380, void
* afterGettingClientData = 0x024c9dd8, <function> * onCloseFunc =
0x00414a20, void * onCloseClientData = 0x024c9dd8)+0xd1
[e:\officialdata\rtp\live\live-latest\livemedia\framedsource.cpp @ 79]
0012f434 0041423d
testOnDemandRTSPServer!MultiFramedRTPSink::packFrame(void)+0x125
[e:\officialdata\rtp\live\live-latest\livemedia\multiframedrtpsink.cpp
@ 217]
0012f444 004140f1
testOnDemandRTSPServer!MultiFramedRTPSink::buildAndSendPacket(unsigned
int isFirstPacket = 1)+0xfd
[e:\officialdata\rtp\live\live-latest\livemedia\multiframedrtpsink.cpp
@ 191]
0012f454 0040b071
testOnDemandRTSPServer!MultiFramedRTPSink::continuePlaying(void)+0x11
[e:\officialdata\rtp\live\live-latest\livemedia\multiframedrtpsink.cpp
@ 152]
0012f468 00409784 testOnDemandRTSPServer!MediaSink::startPlaying(class
MediaSource * source = 0x024c97a8, <function> * afterFunc =
0x004097d0, void * afterClientData = 0x024c9d30)+0x91
[e:\officialdata\rtp\live\live-latest\livemedia\mediasink.cpp @ 79]
0012f484 004090ab
testOnDemandRTSPServer!StreamState::startPlaying(class Destinations *
dests = 0x024c9b30, <function> * rtcpRRHandler = 0x004057e0, void *
rtcpRRHandlerClientData = 0x00625630, <function> *
serverRequestAlternativeByteHandler = 0x00402880, void *
serverRequestAlternativeByteHandlerClientData = 0x00625630)+0x1a4
[e:\officialdata\rtp\live\live-latest\livemedia\ondemandservermediasubsession.cpp
@ 481]
0012f4ac 004048ff
testOnDemandRTSPServer!OnDemandServerMediaSubsession::startStream(unsigned
int clientSessionId = 0x29, void * streamToken = 0x024c9d30,
<function> * rtcpRRHandler = 0x004057e0, void *
rtcpRRHandlerClientData = 0x00625630, unsigned short * rtpSeqNum =
0x0012f510, unsigned int * rtpTimestamp = 0x0012f50c, <function> *
serverRequestAlternativeByteHandler = 0x00402880, void *
serverRequestAlternativeByteHandlerClientData = 0x00625630)+0x4b
[e:\officialdata\rtp\live\live-latest\livemedia\ondemandservermediasubsession.cpp
@ 272]
0012f5c4 004043b5
testOnDemandRTSPServer!RTSPServer::RTSPClientSession::handleCmd_PLAY(class
ServerMediaSubsession * subsession = 0x00000000, char * cseq =
0x0012f8b8 "5", char * fullRequestStr = 0x00625660 "PLAY
rtsp://107.108.199.135:8554/AC3AudioTest/ RTSP/1.0..CSeq:
5..User-Agent: LibVLC/1.1.7 (LIVE555 Streaming Media
v2011.01.06)..Session: 00000029..Range: npt=0.000-....")+0x45f
[e:\officialdata\rtp\live\live-latest\livemedia\rtspserver.cpp @ 1150]
0012f5ec 00402f21
testOnDemandRTSPServer!RTSPServer::RTSPClientSession::handleCmd_withinSession(char
* cmdName = 0x0012fa50 "PLAY", char * urlPreSuffix = 0x0012f988
"AC3AudioTest", char * urlSuffix = 0x0012f7f0 "", char * cseq =
0x0012f8b8 "5", char * fullRequestStr = 0x00625660 "PLAY
rtsp://107.108.199.135:8554/AC3AudioTest/ RTSP/1.0..CSeq:
5..User-Agent: LibVLC/1.1.7 (LIVE555 Streaming Media
v2011.01.06)..Session: 00000029..Range: npt=0.000-....")+0x215
[e:\officialdata\rtp\live\live-latest\livemedia\rtspserver.cpp @ 1011]
0012fb20 00402869
testOnDemandRTSPServer!RTSPServer::RTSPClientSession::handleRequestBytes(int
newBytesRead = 0n170)+0x631
[e:\officialdata\rtp\live\live-latest\livemedia\rtspserver.cpp @ 468]
0012fb48 00402802
testOnDemandRTSPServer!RTSPServer::RTSPClientSession::incomingRequestHandler1(void)+0x59
[e:\officialdata\rtp\live\live-latest\livemedia\rtspserver.cpp @ 357]
0012fb54 0041c93b
testOnDemandRTSPServer!RTSPServer::RTSPClientSession::incomingRequestHandler(void
* instance = 0x00625630, int __formal = 0n2)+0x12
[e:\officialdata\rtp\live\live-latest\livemedia\rtspserver.cpp @ 350]
0012fedc 0041ed71
testOnDemandRTSPServer!BasicTaskScheduler::SingleStep(unsigned int
maxDelayTime = 0)+0x55b
[e:\officialdata\rtp\live\live-latest\basicusageenvironment\basictaskscheduler.cpp
@ 130]
0012feec 00401265
testOnDemandRTSPServer!BasicTaskScheduler0::doEventLoop(char *
watchVariable = 0x00000000 "")+0x31
[e:\officialdata\rtp\live\live-latest\basicusageenvironment\basictaskscheduler0.cpp
@ 81]
0012ff44 004013f9 testOnDemandRTSPServer!main(int argc = 0n1, char **
argv = 0x00232e80)+0x265
[e:\officialdata\rtp\live\live-latest\testprogs\testondemandrtspserver.cpp
@ 283]

---------------------------------------------------------------------------------------------------------------------------------------
4. Debug prints on Server
---------------------------------------------------------------------------------------------------------------------------------------

AC3AudioStreamParser::parseFrame() EXCEPTION (This is normal behavior - *not* an
 error)
AC3AudioStreamParser::parseFrame() EXCEPTION (This is normal behavior - *not* an
 error)
AC3AudioStreamParser::parseFrame() EXCEPTION (This is normal behavior - *not* an
 error)
sending response: RTSP/1.0 200 OK
CSeq: 4
Date: Wed, Mar 23 2011 10:09:55 GMT
Transport: RTP/AVP;unicast;destination=107.108.199.135;source=107.108.199.135;cl
ient_port=49412-49413;server_port=6970-6971
Session: 00000029

Liveness indication from client at 107.108.199.135
RTSPClientSession[0266E888]::handleRequestBytes() read 170 new bytes:PLAY rtsp:/
/107.108.199.135:8554/AC3AudioTest/ RTSP/1.0
CSeq: 5
User-Agent: LibVLC/1.1.7 (LIVE555 Streaming Media v2011.01.06)
Session: 00000029
Range: npt=0.000-

parseRTSPRequestString() succeeded, returning cmdName "PLAY", urlPreSuffix "AC3A
udioTest", urlSuffix ""
RTCPInstance[00363038]::RTCPInstance()
schedule(1.026029->1300874996.567368)
RTCPInstance[00363038]::~RTCPInstance()
sending BYE
sending RTCP packet
 80c80006 800000f3 d1344573 8aa3cea7 000046c8 00000000 00000000 81cb0001 800000f
3


---------------------------------------------------------------------------------------------------------------------------------------
5. ------ Changes in testOnDemandRTSPServer.cpp for AC3
---------------------------------------------------------------------------------------------------------------------------------------
  // A AC3 video elementary stream:
  {
    char const* streamName = "AC3AudioTest";
    char const* inputFileName = "test.ac3";
    ServerMediaSession* sms
      = ServerMediaSession::createNew(*env, streamName, streamName,
				      descriptionString);

    sms->addSubsession(AC3AudioFileServerMediaSubsession
       ::createNew(*env, inputFileName, reuseFirstSource));

    rtspServer->addServerMediaSession(sms);

    announceStream(rtspServer, sms, streamName, inputFileName);
  }


More information about the live-devel mailing list