当前位置: 代码迷 >> 多媒体/流媒体开发 >> openRTST 调试有关问题 ( FileSink.addData函数 相关 )
  详细解决方案

openRTST 调试有关问题 ( FileSink.addData函数 相关 )

热度:1877   发布时间:2013-02-26 00:00:00.0
openRTST 调试问题 ( FileSink.addData函数 相关 )
live555 的openRTSP 程序。
  我要实现的功能,就是接收数据,并把数据传给解码模块播放。思路是在FileSink的addData函数中处理。修改FileSink.addData函数,给其加上打印语句,就是红色部分。
  按我的理解,addData函数是写文件部分,应该频繁的被调用,但实际打印了一次。如果这样的话,还能不能再addData函数中处理呢? addData函数是干什么呢?
  当程序打印到 Receiving streamed data (for up to 75.000000 seconds) 时,慢了下来,应该是在接收数据,这又对应的程序什么地方呢?是不是该在这个地方下手呢?
 


Platform Type : PocketPC
Sending request: OPTIONS rtsp://www.localhost.com.cn:554/sample_300kbit.mp4 RTSP/1.0

CSeq: 1

User-Agent: Window_RTSP (LIVE555 Streaming Media v2010.01.22)




Received OPTIONS response: RTSP/1.0 200 OK

Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )

Cseq: 1

Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD




Sending request: DESCRIBE rtsp://www.localhost.com.cn:554/sample_300kbit.mp4 RTSP/1.0

CSeq: 2

Accept: application/sdp

User-Agent: Window_RTSP (LIVE555 Streaming Media v2010.01.22)




Received DESCRIBE response: 
Need to read 1269 extra bytes
Read 1269 extra bytes: 
Opened URL "rtsp://www.localhost.com.cn:554/sample_300kbit.mp4", returning a SDP description:

Created receiver for "video/MP4V-ES" subsession (client ports 1446-1447)
Created receiver for "audio/MPEG4-GENERIC" subsession (client ports 1448-1449)
Sending request: SETUP rtsp://www.localhost.com.cn:554/sample_300kbit.mp4/trackID=3 RTSP/1.0

CSeq: 3

Transport: RTP/AVP;unicast;client_port=1446-1447

User-Agent: Window_RTSP (LIVE555 Streaming Media v2010.01.22)




Received SETUP response: 
Setup "video/MP4V-ES" subsession (client ports 1446-1447)
Sending request: SETUP rtsp://www.localhost.com.cn:554/sample_300kbit.mp4/trackID=4 RTSP/1.0

CSeq: 4

Transport: RTP/AVP;unicast;client_port=1448-1449

Session: 6657038914577620910

User-Agent: Window_RTSP (LIVE555 Streaming Media v2010.01.22)




Received SETUP response: 
Setup "audio/MPEG4-GENERIC" subsession (client ports 1470-1471)
Created output file: "video-MP4V-ES-1"
my_debug FileSink::addData 函数  
my_debug the dataSize is 32
Created output file: "audio-MPEG4-GENERIC-2"
Sending request: PLAY rtsp://www.happyever.com.cn:554/sample_300kbit.mp4/ RTSP/1.0
CSeq: 5

Session: 6657038914577620910

Range: npt=0.000-70.000

User-Agent: Window_RTSP (LIVE555 Streaming Media v2010.01.22)




Received PLAY response: 
Started playing session
Receiving streamed data (for up to 75.000000 seconds)...
此处比较费时,应该是在这个地方接受数据

Sending request: TEARDOWN rtsp://www.localhost.com.cn:554/sample_300kbit.mp4/ RTSP/1.0

CSeq: 6

Session: 6657038914577620910

User-Agent: Window_RTSP (LIVE555 Streaming Media v2010.01.22)




Received TEARDOWN response: RTSP/1.0 200 OK

Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )

Cseq: 6

Session: 6657038914577620910

Connection: Close




程序“[0xE365F9DA] Window_RTSP.exe”已退出,返回值为 0 (0x0)。


------解决方案--------------------------------------------------------
doEventLoop通过调用continuePlaying()循环取数,Filesink中continuePlaying()是真正的取数方法,通过getNextFrame每次获取一帧数据。
建议参考Mplayer源码中demux_rtp.cpp中的getBuffer接口,完成读取音视频数据直接送到解码器。