效果图如下:

520e599543a2cfc3072ad505df9bfde1.png

9a0a0c371359f43c7501d76c1d4594bf.png

7415fccf9657599a85a1b18cac65d646.png

ab7d4a209ca0dce9953d419c712801ad.png

//-------------------------------------------------------------------------------------------------------------------------------------//

SDP日志如下:

06-06 11:13:22.326: I/RTSPServer_jni(814): [RTSPServer.cpp:432 void

RTSPServer::incomingConnectionHandler(int)]: accept()ed connection from

192.168.1.100

06-06 11:13:22.328: I/RTSPServer_jni(814): [RTSPServer.cpp:898 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

RTSPClientConnection[0x55618080]::handleRequestBytes() read 121 new

bytes:OPTIONS rtsp://192.168.1.101:8554/1 RTSP/1.0

06-06 11:13:22.328: I/RTSPServer_jni(814): CSeq: 2

06-06 11:13:22.328: I/RTSPServer_jni(814): User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)

06-06 11:13:22.328: I/RTSPServer_jni(814):

06-06 11:13:22.328: I/RTSPServer_jni(814): [RTSPServer.cpp:985 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

parseRTSPRequestString() succeeded, returning cmdName "OPTIONS",

urlPreSuffix "", urlSuffix "1", CSeq "2", Content-Length 0, with

0 bytes following the message.

06-06 11:13:22.328: I/RTSPServer_jni(814): [RTSPServer.cpp:1124 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]: sending

response: RTSP/1.0 200 OK

06-06 11:13:22.328: I/RTSPServer_jni(814): CSeq: 2

06-06 11:13:22.328: I/RTSPServer_jni(814): Date: Tue, Jun 06 2017 03:13:22 GMT

06-06 11:13:22.328: I/RTSPServer_jni(814): Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER

06-06 11:13:22.328: I/RTSPServer_jni(814):

06-06 11:13:22.364: I/RTSPServer_jni(814): [RTSPServer.cpp:898 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

RTSPClientConnection[0x55618080]::handleRequestBytes() read 147 new

bytes:DESCRIBE rtsp://192.168.1.101:8554/1 RTSP/1.0

06-06 11:13:22.364: I/RTSPServer_jni(814): CSeq: 3

06-06 11:13:22.364: I/RTSPServer_jni(814): User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)

06-06 11:13:22.364: I/RTSPServer_jni(814): Accept: application/sdp

06-06 11:13:22.364: I/RTSPServer_jni(814):

06-06 11:13:22.364: I/RTSPServer_jni(814): [RTSPServer.cpp:985 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

parseRTSPRequestString() succeeded, returning cmdName "DESCRIBE",

urlPreSuffix "", urlSuffix "1", CSeq "3", Content-Length 0, with

0 bytes following the message.

06-06 11:13:22.502: I/RTSPServer_jni(814): [RTSPServer.cpp:1124 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]: sending

response: RTSP/1.0 200 OK

06-06 11:13:22.502: I/RTSPServer_jni(814): CSeq: 3

06-06 11:13:22.502: I/RTSPServer_jni(814): Date: Tue, Jun 06 2017 03:13:22 GMT

06-06 11:13:22.502: I/RTSPServer_jni(814): Content-Base: rtsp://192.168.1.101:8554/1/

06-06 11:13:22.502: I/RTSPServer_jni(814): Content-Type: application/sdp

06-06 11:13:22.502: I/RTSPServer_jni(814): Content-Length: 673

06-06 11:13:22.502: I/RTSPServer_jni(814):

06-06 11:13:22.502: I/RTSPServer_jni(814): v=0

06-06 11:13:22.502: I/RTSPServer_jni(814): o=- 1496717469771075 1 IN IP4 192.168.1.101

06-06 11:13:22.502: I/RTSPServer_jni(814): s=Session streamed by "RTSPServer"

06-06 11:13:22.502: I/RTSPServer_jni(814): i=1

06-06 11:13:22.502: I/RTSPServer_jni(814): t=0 0

06-06 11:13:22.502: I/RTSPServer_jni(814): a=tool:LIVE555 Streaming Media v2014.07.18

06-06 11:13:22.502: I/RTSPServer_jni(814): a=type:broadcast

06-06 11:13:22.502: I/RTSPServer_jni(814): a=control:rtsp://192.168.1.101:8554/1

06-06 11:13:22.502: I/RTSPServer_jni(814): a=range:npt=0-

06-06 11:13:22.502: I/RTSPServer_jni(814): a=x-qt-text-nam:Session streamed by "RTSPServer"

06-06 11:13:22.502: I/RTSPServer_jni(814): a=x-qt-text-inf:1

06-06 11:13:22.502: I/RTSPServer_jni(814): m=video 0 RTP/AVP 96

06-06 11:13:22.502: I/RTSPServer_jni(814): c=IN IP4 0.0.0.0

06-06 11:13:22.502: I/RTSPServer_jni(814): b=AS:500

06-06 11:13:22.502: I/RTSPServer_jni(814): a=rtpmap:96 H264/90000

06-06 11:13:22.502: I/RTSPServer_jni(814): a=fmtp:96

packetization-mode=1;profile-level-id=42C01E;sprop-parameter-sets=Z0LAHrkQFAe0IAAAAwAgAAAFEeLF1A==,aM48gA==

06-06 11:13:22.502: I/RTSPServer_jni(814): a=recvonly;

06-06 11:13:22.502: I/RTSPServer_jni(814): a=control:rtsp://192.168.1.101:8554/1/trackID=1

06-06 11:13:22.502: I/RTSPServer_jni(814): m=audio 0 RTP/AVP 97

06-06 11:13:22.502: I/RTSPServer_jni(814): c=IN IP4 0.0.0.0

06-06 11:13:22.502: I/RTSPServer_jni(814): b=AS:96

06-06 11:13:22.502: I/RTSPServer_jni(814): a=rtpmap:97 PCMA/8000

06-06 11:13:22.502: I/RTSPServer_jni(814): a=recvonly;

06-06 11:13:22.502: I/RTSPServer_jni(814): a=control:rtsp://192.168.1.101:8554/1/trackID=2

06-06 11:13:22.574: I/RTSPServer_jni(814): [RTSPServer.cpp:898 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

RTSPClientConnection[0x55618080]::handleRequestBytes() read 181 new

bytes:SETUP rtsp://192.168.1.101:8554/1/trackID=1 RTSP/1.0

06-06 11:13:22.574: I/RTSPServer_jni(814): CSeq: 4

06-06 11:13:22.574: I/RTSPServer_jni(814): User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)

06-06 11:13:22.574: I/RTSPServer_jni(814): Transport: RTP/AVP;unicast;client_port=59928-59929

06-06 11:13:22.574: I/RTSPServer_jni(814):

06-06 11:13:22.574: I/RTSPServer_jni(814): [RTSPServer.cpp:985 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

parseRTSPRequestString() succeeded, returning cmdName "SETUP",

urlPreSuffix "1", urlSuffix "trackID=1", CSeq "4", Content-Length

0, with 0 bytes following the message.

06-06 11:13:22.585: I/RTSPServer_jni(814): [RTSPServer.cpp:1124 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]: sending

response: RTSP/1.0 200 OK

06-06 11:13:22.585: I/RTSPServer_jni(814): CSeq: 4

06-06 11:13:22.585: I/RTSPServer_jni(814): Date: Tue, Jun 06 2017 03:13:22 GMT

06-06 11:13:22.585: I/RTSPServer_jni(814): Transport:

RTP/AVP;unicast;destination=192.168.1.100;source=192.168.1.101;client_port=59928-59929;server_port=6970-6971

06-06 11:13:22.585: I/RTSPServer_jni(814): Session: FE96A902;timeout=65

06-06 11:13:22.585: I/RTSPServer_jni(814):

06-06 11:13:22.593: I/RTSPServer_jni(814): [RTSPServer.cpp:898 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

RTSPClientConnection[0x55618080]::handleRequestBytes() read 200 new

bytes:SETUP rtsp://192.168.1.101:8554/1/trackID=2 RTSP/1.0

06-06 11:13:22.593: I/RTSPServer_jni(814): CSeq: 5

06-06 11:13:22.593: I/RTSPServer_jni(814): User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)

06-06 11:13:22.593: I/RTSPServer_jni(814): Transport: RTP/AVP;unicast;client_port=59930-59931

06-06 11:13:22.593: I/RTSPServer_jni(814): Session: FE96A902

06-06 11:13:22.593: I/RTSPServer_jni(814):

06-06 11:13:22.593: I/RTSPServer_jni(814): [RTSPServer.cpp:985 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

parseRTSPRequestString() succeeded, returning cmdName "SETUP",

urlPreSuffix "1", urlSuffix "trackID=2", CSeq "5", Content-Length

0, with 0 bytes following the message.

06-06 11:13:22.596: I/RTSPServer_jni(814): [RTSPServer.cpp:1124 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]: sending

response: RTSP/1.0 200 OK

06-06 11:13:22.596: I/RTSPServer_jni(814): CSeq: 5

06-06 11:13:22.596: I/RTSPServer_jni(814): Date: Tue, Jun 06 2017 03:13:22 GMT

06-06 11:13:22.596: I/RTSPServer_jni(814): Transport:

RTP/AVP;unicast;destination=192.168.1.100;source=192.168.1.101;client_port=59930-59931;server_port=6972-6973

06-06 11:13:22.596: I/RTSPServer_jni(814): Session: FE96A902;timeout=65

06-06 11:13:22.596: I/RTSPServer_jni(814):

06-06 11:13:22.628: I/RTSPServer_jni(814): [RTSPServer.cpp:898 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

RTSPClientConnection[0x55618080]::handleRequestBytes() read 156 new

bytes:PLAY rtsp://192.168.1.101:8554/1 RTSP/1.0

06-06 11:13:22.628: I/RTSPServer_jni(814): CSeq: 6

06-06 11:13:22.628: I/RTSPServer_jni(814): User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)

06-06 11:13:22.628: I/RTSPServer_jni(814): Session: FE96A902

06-06 11:13:22.628: I/RTSPServer_jni(814): Range: npt=0.000-

06-06 11:13:22.628: I/RTSPServer_jni(814):

06-06 11:13:22.628: I/RTSPServer_jni(814): [RTSPServer.cpp:985 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

parseRTSPRequestString() succeeded, returning cmdName "PLAY",

urlPreSuffix "", urlSuffix "1", CSeq "6", Content-Length 0, with 0

bytes following the message.

06-06 11:13:22.629: I/RTSPServer_jni(814): [RTSPServer.cpp:1124 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]: sending

response: RTSP/1.0 200 OK

06-06 11:13:22.629: I/RTSPServer_jni(814): CSeq: 6

06-06 11:13:22.629: I/RTSPServer_jni(814): Date: Tue, Jun 06 2017 03:13:22 GMT

06-06 11:13:22.629: I/RTSPServer_jni(814): Range: npt=0.000-

06-06 11:13:22.629: I/RTSPServer_jni(814): Session: FE96A902

06-06 11:13:22.629: I/RTSPServer_jni(814): RTP-Info:

url=rtsp://192.168.1.101:8554/1/trackID=1;seq=37075;rtptime=1897189058,url=rtsp://192.168.1.101:8554/1/trackID=2;seq=25069;rtptime=1038717352

06-06 11:13:22.629: I/RTSPServer_jni(814):

06-06 11:13:22.744: I/RTSPServer_jni(814): [RTSPServer.cpp:898 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

RTSPClientConnection[0x55618080]::handleRequestBytes() read 146 new

bytes:GET_PARAMETER rtsp://192.168.1.101:8554/1 RTSP/1.0

06-06 11:13:22.744: I/RTSPServer_jni(814): CSeq: 7

06-06 11:13:22.744: I/RTSPServer_jni(814): User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)

06-06 11:13:22.744: I/RTSPServer_jni(814): Session: FE96A902

06-06 11:13:22.744: I/RTSPServer_jni(814):

06-06 11:13:22.744: I/RTSPServer_jni(814): [RTSPServer.cpp:985 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]:

parseRTSPRequestString() succeeded, returning cmdName "GET_PARAMETER",

urlPreSuffix "", urlSuffix "1", CSeq "7", Content-Length 0,

with 0 bytes following the message.

06-06 11:13:22.745: I/RTSPServer_jni(814): [RTSPServer.cpp:1124 void

RTSPServer::RTSPClientConnection::handleRequestBytes(int)]: sending

response: RTSP/1.0 200 OK

06-06 11:13:22.745: I/RTSPServer_jni(814): CSeq: 7

06-06 11:13:22.745: I/RTSPServer_jni(814): Date: Tue, Jun 06 2017 03:13:22 GMT

06-06 11:13:22.745: I/RTSPServer_jni(814): Session: FE96A902

06-06 11:13:22.745: I/RTSPServer_jni(814): Content-Length: 10

06-06 11:13:22.745: I/RTSPServer_jni(814):

06-06 11:13:22.745: I/RTSPServer_jni(814): 2014.07.18

06-06 11:13:25.488: I/RTSPServer_jni(814): [RTSPServer.cpp:2145 static

void

RTSPServer::RTSPClientSession::noteClientLiveness(RTSPServer::RTSPClientSession*)]:

RTSP client session (id "FE96A902", stream name "1"): Liveness

indication

06-06 11:13:25.567: I/RTSPServer_jni(814): [RTSPServer.cpp:2145 static

void

RTSPServer::RTSPClientSession::noteClientLiveness(RTSPServer::RTSPClientSession*)]:

RTSP client session (id "FE96A902", stream name "1"): Liveness

indication

06-06 11:13:31.077: I/RTSPServer_jni(814): [RTSPServer.cpp:2145 static

void

RTSPServer::RTSPClientSession::noteClientLiveness(RTSPServer::RTSPClientSession*)]:

RTSP client session (id "FE96A902", stream name "1"): Liveness

indication

06-06 11:13:31.077: I/RTSPServer_jni(814): [RTSPServer.cpp:2145 static

void

RTSPServer::RTSPClientSession::noteClientLiveness(RTSPServer::RTSPClientSession*)]:

RTSP client session (id "FE96A902", stream name "1"): Liveness

indication

//-------------------------------------------------------------------------------------------------------------------------------------//

技术点:

1、live555实时数据处理(难点)

2、G711编码实现(同时实现AAC编码)

3、音视频时间戳的了解(后期做同步需要深入研究)

4、VLC的日志调试

//-------------------------------------------------------------------------------------------------------------------------------------//

遇到的难点:

1、live555通过队列取G711 ALAW编码数据,数据发生变化导致VLC播放有杂音

解决方案:

查起来麻烦,摈弃队列使用缓存拷贝,VLC播放效果明显变好

2、G711 ALAW编码数据正常,live555推流结束后,VLC才播放开始几包声音数据

原因:VLC播放声音原因时间戳

解决方案:在AudioFrameLiveSource::doGetNextFrame()中添加gettimeofday(&fPresentationTime,NULL);

3、单独视频流单独音频流VLC都播放正常。两路流一起推,VLC黑屏声音正常

原因:live555单线程机制,AudioFrameLiveSource::doGetNextFrame()和VideoFrameLiveSource::doGetNextFrame()两个不能都有阻塞操作,出现上述现象是因为,AudiodoGetNextFrame获取实时数据频率高且有阻塞等待现象,导致视频VideodoGetNextFrame也无法处理数据。

解决方案:目前机制AudiodoGetNextFrame获取实时数据失败不做等待且memcpy(fTo,audiodata,0),VideodoGetNextFrame仍阻塞获取实时数据。效果不错!

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐