live555库的使用总结

一、

live555\testProgs\testRTSPClient.cpp 测试rtsp命令和数据接收:

1.发送并处理Describe消息

 rtspClient->sendDescribeCommand(continueAfterDESCRIBE);

 

2.发送并处理Setup消息

     rtspClient->sendSetupCommand(*scs.subsession, continueAfterSETUP);

 

3. 创建sink,准备接收媒体数据

scs.subsession->sink =DummySink::createNew(env, *scs.subsession, rtspClient->url());

 

4.开始播放

   scs.subsession->sink->startPlaying(*(scs.subsession->readSource()),

                                                                   subsessionAfterPlaying, scs.subsession);

 

 

5.获取媒体数据

Poll 模式调用getNexFrame获取媒体数据

 fSource->getNextFrame(fReceiveBuffer, DUMMY_SINK_RECEIVE_BUFFER_SIZE,

                        afterGettingFrame,this,

                        onSourceClosure, this);

 

VLC 的live555插件也是使用poll模式调用getNexFame 获取媒体数据


日志信息

------------------------------------------------------------------------------------------------------------------------------------



$ ./testRTSPClient rtsp://10.148.6.83:8554/123.mp3
Opening connection to 10.148.6.83, port 8554...
...remote connection opened
Sending request: DESCRIBE rtsp://10.148.6.83:8554/123.mp3 RTSP/1.0
CSeq: 2
User-Agent: ./testRTSPClient (LIVE555 Streaming Media v2013.08.16)
Accept: application/sdp




Received 554 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 2
Date: Thu, Aug 29 2013 08:28:33 GMT
Content-Base: rtsp://10.148.6.83:8554/123.mp3/
Content-Type: application/sdp
Content-Length: 389


v=0
o=- 1377764913366009 1 IN IP4 10.148.6.83
s=MPEG-1 or 2 Audio, streamed by the LIVE555 Media Server
i=123.mp3
t=0 0
a=tool:LIVE555 Streaming Media v2013.04.01
a=type:broadcast
a=control:*
a=range:npt=0-115.984
a=x-qt-text-nam:MPEG-1 or 2 Audio, streamed by the LIVE555 Media Server
a=x-qt-text-inf:123.mp3
m=audio 0 RTP/AVP 14
c=IN IP4 0.0.0.0
b=AS:128
a=control:track1


[URL:"rtsp://10.148.6.83:8554/123.mp3/"]: Got a SDP description:
v=0
o=- 1377764913366009 1 IN IP4 10.148.6.83
s=MPEG-1 or 2 Audio, streamed by the LIVE555 Media Server
i=123.mp3
t=0 0
a=tool:LIVE555 Streaming Media v2013.04.01
a=type:broadcast
a=control:*
a=range:npt=0-115.984
a=x-qt-text-nam:MPEG-1 or 2 Audio, streamed by the LIVE555 Media Server
a=x-qt-text-inf:123.mp3
m=audio 0 RTP/AVP 14
c=IN IP4 0.0.0.0
b=AS:128
a=control:track1


[URL:"rtsp://10.148.6.83:8554/123.mp3/"]: Initiated the "audio/MPA" subsession (client ports 59780-59781)
Sending request: SETUP rtsp://10.148.6.83:8554/123.mp3/track1 RTSP/1.0
CSeq: 3
User-Agent: ./testRTSPClient (LIVE555 Streaming Media v2013.08.16)
Transport: RTP/AVP;unicast;client_port=59780-59781




Received 201 new bytes of response data.
Received a complete SETUP response:
RTSP/1.0 200 OK
CSeq: 3
Date: Thu, Aug 29 2013 08:28:33 GMT
Transport: RTP/AVP;unicast;destination=10.148.6.83;source=10.148.6.83;client_port=59780-59781;server_port=6970-6971
Session: 317A2B2D




[URL:"rtsp://10.148.6.83:8554/123.mp3/"]: Set up the "audio/MPA" subsession (client ports 59780-59781)
[URL:"rtsp://10.148.6.83:8554/123.mp3/"]: Created a data sink for the "audio/MPA" subsession
Sending request: PLAY rtsp://10.148.6.83:8554/123.mp3/ RTSP/1.0
CSeq: 4
User-Agent: ./testRTSPClient (LIVE555 Streaming Media v2013.08.16)
Session: 317A2B2D
Range: npt=0.000-




Stream "rtsp://10.148.6.83:8554/123.mp3/"; audio/MPA:   Received 835 bytes.     Presentation time: 1377764913.797714!
Received 186 new bytes of response data.
Received a complete PLAY response:
RTSP/1.0 200 OK
CSeq: 4
Date: Thu, Aug 29 2013 08:28:33 GMT
Range: npt=0.000-
Session: 317A2B2D
RTP-Info: url=rtsp://10.148.6.83:8554/123.mp3/track1;seq=49924;rtptime=3855656678




[URL:"rtsp://10.148.6.83:8554/123.mp3/"]: Started playing session (for up to 117.984000 seconds)...
Stream "rtsp://10.148.6.83:8554/123.mp3/"; audio/MPA:   Received 835 bytes.     Presentation time: 1377764913.849856
Stream "rtsp://10.148.6.83:8554/123.mp3/"; audio/MPA:   Received 836 bytes.     Presentation time: 1377764913.902100
Stream "rtsp://10.148.6.83:8554/123.mp3/"; audio/MPA:   Received 836 bytes.     Presentation time: 1377764913.954344
Stream "rtsp://10.148.6.83:8554/123.mp3/"; audio/MPA:   Received 836 bytes.     Presentation time: 1377764914.006588
Stream "rtsp://10.148.6.83:8554/123.mp3/"; audio/MPA:   Received 836 bytes.     Presentation time: 1377764914.058832
Stream "rtsp://10.148.6.83:8554/123.mp3/"; audio/MPA:   Received 836 bytes.     Presentation time: 1377764914.111087
Stream "rtsp://10.148.6.83:8554/123.mp3/"; audio/MPA:   Received 836 bytes.     Presentation time: 1377764914.163331
Stream "rtsp://10.148.6.83:8554/123.mp3/"; audio/MPA:   Received 836 bytes.     Presentation time: 1377764914.215575

你可能感兴趣的:(多媒体编程)