Missing keep-alives in Rtsp session

Topics: Question
Mar 25, 2015 at 12:38 AM
I'm using the RTSPClient to connect to a hikvision HD camera. After about 90
seconds the video streams from the camera stop running. (no more video bytes are sent
from the camera and the camera closes the connection).

I noticed that when connecting to the same camera with VLC Player the video ran
indefinitely. So I compared the Wireshark logs between MMA 111202 and VLC, focusing on port
554 traffic. The difference appears to be that VLC sends keep-alives (Get_Parameters) every
60 seconds, wheras MMA 111202 does not. (The camera specifies timeout=60 in its response header for the SETUP message.)

I also looked at the Wireshark RTSP conversation for the Foscam HD camera which does not have this stopping issue. Again the keep-alive was not being sent by MMA 111202, however the Foscam doesn't seem to care. It keeps on pumping out the streams.

Is this a bug, or operator error?

I can provide the Wireshark data if needed.

Thanks.
Coordinator
Mar 25, 2015 at 1:36 AM
Interesting, it should be sent. Unless the media would end before it would be received.

Let me try to replicate it before I ask for anything.

Can you also post the session description, this might be related to that also.

Thanks
Marked as answer by juliusfriedman on 3/24/2015 at 6:37 PM
Coordinator
Mar 25, 2015 at 2:55 AM
Edited Mar 25, 2015 at 2:56 AM
I can't replicate this from the TestRtspClient program in that version, definitely post the SessionDescription and the Wireshark capture if possible.

Here is what I get running under TCP in that test:

"
Remaining Time in media:00:30:18.1820714
Client Sent Request :OPTIONS rtsp://quicktime.uvm.edu:1554/waw/wdi05hs2b.mov RTSP/1.0
CSeq: 6
Session: 1731983668226767050


Client Received Response :RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 6
Session: 1731983668226767050
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD
"

Thanks!
Marked as answer by juliusfriedman on 3/24/2015 at 7:55 PM
Mar 25, 2015 at 4:21 AM
Here are the WireShark files for MMA and VLC.
https://www.cubbyusercontent.com/pl/mma_111202_Keep-Alive/_d93319368e314396832753eae9a23de3#mma_111202_Keep-Alive

Thanks for looking at this. Hope it's an easy one.

And here are the port 554 summaries:

MMA 111202:

OPTIONS rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4 RTSP/1.0
CSeq: 1
Authorization: Digest username="admin", realm="", nonce="2F3FCDFD", uri="rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4", response="ea8430e80424bf885f0e553ed1f32415"

RTSP/1.0 200 OK
CSeq: 1
Public: OPTIONS, DESCRIBE, PLAY, PAUSE, SETUP, TEARDOWN, SET_PARAMETER, GET_PARAMETER
Date: Tue, Mar 24 2015 09:19:03 GMT

DESCRIBE rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4 RTSP/1.0
Accept: application/sdp
CSeq: 2
Authorization: Digest username="admin", realm="", nonce="6AFD5FDE", uri="rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4", response="d944e182cf833d4f092e6e5e82942fcb"

RTSP/1.0 200 OK
CSeq: 2
Content-Type: application/sdp
Content-Base: rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4/ Content-Length: 743

v=0
o=- 1427188743456519 1427188743456519 IN IP4 192.168.0.148
s=Media Presentation
e=NONE
b=AS:5100
t=0 0
a=control:rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4/ m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=control:rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4/trackID=1 a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AKZpmA8ARPyzUBAQFAAADA+gAAJxABA==,aO48gA==
m=audio 0 RTP/AVP 0
c=IN IP4 0.0.0.0
b=AS:50
a=recvonly
a=control:rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4/trackID=2 a=rtpmap:0 PCMU/8000
a=Media_header:MEDIAINFO=494D4B48010100000400010010710110401F000000FA000000000000000000000000000000000000;
a=appversion:1.0
SETUP rtsp://admin:A70212295@192.168.0.148/cam1/mpeg4/trackID=1 RTSP/1.0
Transport: RTP/AVP/UDP;unicast;client_port=10000-10001;mode="PLAY"
CSeq: 3
Authorization: Digest username="admin", realm="", nonce="3DF61DFF", uri="rtsp://admin:A70212295@192.168.0.148/cam1/mpeg4/trackID=1", response="5139f1e4019ac8be174e4121a6aa203a"

RTSP/1.0 200 OK
CSeq: 3
Session: 2144158513;timeout=60
Transport: RTP/AVP/UDP;unicast;client_port=10000-10001;mode="PLAY";server_port=8238-8239;ssrc=5b8755e7;mode="play"
Date: Tue, Mar 24 2015 09:19:03 GMT

SETUP rtsp://admin:A70212295@192.168.0.148/cam1/mpeg4/trackID=2 RTSP/1.0
Transport: RTP/AVP/UDP;unicast;client_port=10002-10003;mode="PLAY"
CSeq: 4
Authorization: Digest username="admin", realm="", nonce="79BFFC5D", uri="rtsp://admin:A70212295@192.168.0.148/cam1/mpeg4/trackID=2", response="39a927adc92f8a062585f11ab7a40a85"
Session: 2144158513

RTSP/1.0 200 OK
CSeq: 4
Session: 2144158513;timeout=60
Transport: RTP/AVP/UDP;unicast;client_port=10002-10003;mode="PLAY";server_port=8240-8241;ssrc=39e75953;mode="play"
Date: Tue, Mar 24 2015 09:19:03 GMT

PLAY rtsp://192.168.0.148:554/cam1/mpeg4 RTSP/1.0
Range: npt=now-
CSeq: 5
Authorization: Digest username="admin", realm="", nonce="1FEF75F3", uri="rtsp://192.168.0.148:554/cam1/mpeg4", response="f06cf18a0cdcf3e3aa6c3ec607a90139"
Session: 2144158513

RTSP/1.0 200 OK
CSeq: 5
Session: 2144158513
RTP-Info: url=rtsp://192.168.0.148:554/cam1/mpeg4/trackID=1;seq=38363;rtptime=3565825354,url=rtsp://192.168.0.148:554/cam1/mpeg4/trackID=2;seq=63906;rtptime=316962224
Date: Tue, Mar 24 2015 09:19:03 GMT

GET_PARAMETER rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4 RTSP/1.0
CSeq: 6
Authorization: Digest username="admin", realm="", nonce="7EBB7D3F", uri="rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4", response="8097ffc5cc086b50d0d51fcc45feb24e"
Session: 2144158513

RTSP/1.0 200 OK
CSeq: 6
Date: Tue, Mar 24 2015 09:19:33 GMT


And VLC:

OPTIONS rtsp://192.168.0.148:554/cam1/mpeg4 RTSP/1.0
CSeq: 2
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)

RTSP/1.0 200 OK
CSeq: 2
Public: OPTIONS, DESCRIBE, PLAY, PAUSE, SETUP, TEARDOWN, SET_PARAMETER, GET_PARAMETER
Date: Tue, Mar 24 2015 09:04:56 GMT

DESCRIBE rtsp://192.168.0.148:554/cam1/mpeg4 RTSP/1.0
CSeq: 3
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Accept: application/sdp

RTSP/1.0 401 Unauthorized
CSeq: 3
WWW-Authenticate: Digest realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", stale="FALSE"
WWW-Authenticate: Basic realm="c056e3bc19bb"
Date: Tue, Mar 24 2015 09:04:56 GMT

DESCRIBE rtsp://192.168.0.148:554/cam1/mpeg4 RTSP/1.0
CSeq: 4
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4", response="909076a360396dd56593118b91024098"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Accept: application/sdp

RTSP/1.0 200 OK
CSeq: 4
Content-Type: application/sdp
Content-Base: rtsp://192.168.0.148:554/cam1/mpeg4/
Content-Length: 695

v=0
o=- 1427187896136921 1427187896136921 IN IP4 192.168.0.148
s=Media Presentation
e=NONE
b=AS:5100
t=0 0
a=control:rtsp://192.168.0.148:554/cam1/mpeg4/
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=control:rtsp://192.168.0.148:554/cam1/mpeg4/trackID=1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AKZpmA8ARPyzUBAQFAAADA+gAAJxABA==,aO48gA==
m=audio 0 RTP/AVP 0
c=IN IP4 0.0.0.0
b=AS:50
a=recvonly
a=control:rtsp://192.168.0.148:554/cam1/mpeg4/trackID=2
a=rtpmap:0 PCMU/8000
a=Media_header:MEDIAINFO=494D4B48010100000400010010710110401F000000FA000000000000000000000000000000000000;
a=appversion:1.0
SETUP rtsp://192.168.0.148:554/cam1/mpeg4/trackID=1 RTSP/1.0
CSeq: 5
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="fe6c4ced21d7323361dbcba09227f325"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Transport: RTP/AVP;unicast;client_port=52606-52607

RTSP/1.0 200 OK
CSeq: 5
Session: 1614043764;timeout=60
Transport: RTP/AVP;unicast;client_port=52606-52607;server_port=8234-8235;ssrc=2cb5879f;mode="play"
Date: Tue, Mar 24 2015 09:04:56 GMT

SETUP rtsp://192.168.0.148:554/cam1/mpeg4/trackID=2 RTSP/1.0
CSeq: 6
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="fe6c4ced21d7323361dbcba09227f325"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Transport: RTP/AVP;unicast;client_port=52608-52609
Session: 1614043764

RTSP/1.0 200 OK
CSeq: 6
Session: 1614043764;timeout=60
Transport: RTP/AVP;unicast;client_port=52608-52609;server_port=8236-8237;ssrc= 2eeed1c;mode="play"
Date: Tue, Mar 24 2015 09:04:56 GMT

PLAY rtsp://192.168.0.148:554/cam1/mpeg4/ RTSP/1.0
CSeq: 7
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="62f1211dc41e0f22afc0d2f4eae53fd7"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Session: 1614043764
Range: npt=0.000-

RTSP/1.0 200 OK
CSeq: 7
Session: 1614043764
RTP-Info: url=rtsp://192.168.0.148:554/cam1/mpeg4/trackID=1;seq=36533;rtptime=3489535958,url=rtsp://192.168.0.148:554/cam1/mpeg4/trackID=2;seq=43112;rtptime=310180784
Date: Tue, Mar 24 2015 09:04:56 GMT

GET_PARAMETER rtsp://192.168.0.148:554/cam1/mpeg4/ RTSP/1.0
CSeq: 8
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="999a3a83a0475da29978ea68abeb5e97"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Session: 1614043764

RTSP/1.0 200 OK
CSeq: 8
Date: Tue, Mar 24 2015 09:04:56 GMT

GET_PARAMETER rtsp://192.168.0.148:554/cam1/mpeg4/ RTSP/1.0
CSeq: 9
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="999a3a83a0475da29978ea68abeb5e97"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Session: 1614043764

RTSP/1.0 200 OK
CSeq: 9
Date: Tue, Mar 24 2015 09:05:54 GMT

GET_PARAMETER rtsp://192.168.0.148:554/cam1/mpeg4/ RTSP/1.0
CSeq: 10
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="999a3a83a0475da29978ea68abeb5e97"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Session: 1614043764

RTSP/1.0 200 OK
CSeq: 10
Date: Tue, Mar 24 2015 09:06:52 GMT

GET_PARAMETER rtsp://192.168.0.148:554/cam1/mpeg4/ RTSP/1.0
CSeq: 11
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="999a3a83a0475da29978ea68abeb5e97"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Session: 1614043764

RTSP/1.0 200 OK
CSeq: 11
Date: Tue, Mar 24 2015 09:07:50 GMT

GET_PARAMETER rtsp://192.168.0.148:554/cam1/mpeg4/ RTSP/1.0
CSeq: 12
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="999a3a83a0475da29978ea68abeb5e97"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Session: 1614043764

RTSP/1.0 200 OK
CSeq: 12
Date: Tue, Mar 24 2015 09:08:48 GMT

GET_PARAMETER rtsp://192.168.0.148:554/cam1/mpeg4/ RTSP/1.0
CSeq: 13
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="999a3a83a0475da29978ea68abeb5e97"
User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)
Session: 1614043764

RTSP/1.0 200 OK
CSeq: 13
Date: Tue, Mar 24 2015 09:09:46 GMT

GET_PARAMETER rtsp://192.168.0.148:554/cam1/mpeg4/ RTSP/1.0
CSeq: 14
Authorization: Digest username="admin", realm="c056e3bc19bb", nonce="1be651c85249ba311009f2f2c44ca474", uri="rtsp://192.168.0.148:554/cam1/mpeg4/", response="999a3a83a0475da29
Coordinator
Mar 25, 2015 at 3:17 PM
Fortunately, there is nothing hard about any of this.

I have seen much more complicated protocols than Rtp and Rtcp combined with Rtsp.

The difficulties which mostly arise are related to how the Rtsp standard is implemented and I am sure that when I move to support Http I will find the same with the Http implementations as well as most Rtsp implementations are just build on top of a Http implementation :)

With that being said, I do believe you that this is happening but I think it may be related to something your doing, possibly at the event level.

"
Remaining Time in media:00:27:17.6084314
Client Sent Request :OPTIONS rtsp://quicktime.uvm.edu:1554/waw/wdi05hs2b.mov RTS
P/1.0
CSeq: 12
Session: 5421704126212138168


Client Received Response :RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 12
Session: 5421704126212138168
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD


Client Playing for :00:03:30.7383774
Remaining Time in media:00:27:15.5946226
Client Playing for :00:03:32.7455997
Remaining Time in media:00:27:13.5874003
Client Playing for :00:03:34.7586153
Remaining Time in media:00:27:11.5743847
Client Playing for :00:03:36.7718293
Remaining Time in media:00:27:09.5611707
Client Playing for :00:03:38.7766462
Remaining Time in media:00:27:07.5563538
Client Playing for :00:03:40.7770534
Remaining Time in media:00:27:05.5559466
Client Playing for :00:03:42.7918796
Remaining Time in media:00:27:03.5411204
Client Playing for :00:03:44.7961103
Remaining Time in media:00:27:01.5368897
Client Playing for :00:03:46.8107295
Remaining Time in media:00:26:59.5222705
Client Playing for :00:03:48.8231504
Remaining Time in media:00:26:57.5098496
Client Playing for :00:03:50.8385757
Remaining Time in media:00:26:55.4944243
Client Playing for :00:03:52.8455867
Remaining Time in media:00:26:53.4874133
Client Playing for :00:03:54.8534038
Remaining Time in media:00:26:51.4795962
Client Playing for :00:03:56.8540223
Remaining Time in media:00:26:49.4789777
Client Playing for :00:03:58.8648439
Remaining Time in media:00:26:47.4681561
Client Sent Request :OPTIONS rtsp://quicktime.uvm.edu:1554/waw/wdi05hs2b.mov RTS
P/1.0
CSeq: 13
Session: 5421704126212138168


Client Received Response :RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 13
Session: 5421704126212138168
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD


Client Playing for :00:04:00.8776699
Remaining Time in media:00:26:45.4553301
Client Playing for :00:04:02.8798832
Remaining Time in media:00:26:43.4531168
Client Playing for :00:04:04.8827087
Remaining Time in media:00:26:41.4502913
Client Playing for :00:04:06.8979358
Remaining Time in media:00:26:39.4350642
Client Playing for :00:04:08.9127576
Remaining Time in media:00:26:37.4202424
Client Playing for :00:04:10.9167771
Remaining Time in media:00:26:35.4162229
Client Playing for :00:04:12.9271935
Remaining Time in media:00:26:33.4058065
Client Playing for :00:04:14.9342131
Remaining Time in media:00:26:31.3987869
"

....

"
Client Playing for :00:04:29.1894700
Remaining Time in media:00:26:17.1435300
Client Sent Request :OPTIONS rtsp://quicktime.uvm.edu:1554/waw/wdi05hs2b.mov RTS
P/1.0
CSeq: 14
Session: 5421704126212138168


Client Received Response :RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 14
Session: 5421704126212138168
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD


Client Playing for :00:04:31.1938860
Remaining Time in media:00:26:15.1391140
Client Playing for :00:04:33.2071000
Remaining Time in media:00:26:13.1259000
Client Playing for :00:04:35.2071106
Remaining Time in media:00:26:11.1258894
Client Playing for :00:04:37.2089231
Remaining Time in media:00:26:09.1240769
Client Playing for :00:04:39.2233354
Remaining Time in media:00:26:07.1096646

"

"
Client Playing for :00:04:31.1938860
Remaining Time in media:00:26:15.1391140
Client Playing for :00:04:33.2071000
Remaining Time in media:00:26:13.1259000
Client Playing for :00:04:35.2071106
Remaining Time in media:00:26:11.1258894
Client Playing for :00:04:37.2089231
Remaining Time in media:00:26:09.1240769
Client Playing for :00:04:39.2233354
Remaining Time in media:00:26:07.1096646
Client Playing for :00:04:41.2357389
Remaining Time in media:00:26:05.0972611
Client Playing for :00:04:50.9781564
Remaining Time in media:00:25:55.3548436
Client Playing for :00:04:52.9787662
Remaining Time in media:00:25:53.3542338
Client Playing for :00:04:54.9851824
Remaining Time in media:00:25:51.3478176
Client Playing for :00:04:56.9889949
Remaining Time in media:00:25:49.3440051
Client Playing for :00:04:58.9918074
Remaining Time in media:00:25:47.3411926
Client Sent Request :OPTIONS rtsp://quicktime.uvm.edu:1554/waw/wdi05hs2b.mov RTS
P/1.0
CSeq: 15
Session: 5421704126212138168


Client Received Response :RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 15
Session: 5421704126212138168
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD


Client Playing for :00:05:01.0072198
Remaining Time in media:00:25:45.3257802
Client Playing for :00:05:03.0136446
Remaining Time in media:00:25:43.3193554
Client Playing for :00:05:05.0174485
Remaining Time in media:00:25:41.3155515
Client Playing for :00:05:07.0182523
Remaining Time in media:00:25:39.3147477
Client Playing for :00:05:09.0316559
Remaining Time in media:00:25:37.3013441
Client Playing for :00:05:11.0344597
Remaining Time in media:00:25:35.2985403
Client Playing for :00:05:13.0468632
Remaining Time in media:00:25:33.2861368
Client Playing for :00:05:15.0612669
Remaining Time in media:00:25:31.2717331
Client Playing for :00:05:17.0736704
Remaining Time in media:00:25:29.2593296
Client Playing for :00:05:19.0790779
Remaining Time in media:00:25:27.2539221
Client Playing for :00:05:21.0795110
Remaining Time in media:00:25:25.2534890
Client Playing for :00:05:23.0829400
Remaining Time in media:00:25:23.2500600
Client Playing for :00:05:25.0949469
Remaining Time in media:00:25:21.2380531

"

...

"
Remaining Time in media:00:25:19.2368398
Client Sent Request :OPTIONS rtsp://quicktime.uvm.edu:1554/waw/wdi05hs2b.mov RTS
P/1.0
CSeq: 16
Session: 5421704126212138168


Client Received Response :RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 16
Session: 5421704126212138168
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD


"

"

Remaining Time in media:00:24:55.0200750
Client Sent Request :OPTIONS * RTSP/1.0
CSeq: 17
Session: 5421704126212138168


Client Received Response :RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 17
Session: 5421704126212138168
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD


RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 17
Session: 5421704126212138168
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD


Client Sent Request :OPTIONS * RTSP/1.0
CSeq: 18
Session: 5421704126212138168


Client Received Response :RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 18
Session: 5421704126212138168
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD


RTSP/1.0 200 OK
Server: DSS/5.5.5 (Build/489.16; Platform/Linux; Release/Darwin; state/beta; )
Cseq: 18
Session: 5421704126212138168
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, OPTIONS, ANNOUNCE, RECORD
    *****************Stopping All Playback. (Press Q To Exit)
Client Sent Request :TEARDOWN rtsp://quicktime.uvm.edu:1554/waw/wdi05hs2b.mov RT
SP/1.0
Connection: close
CSeq: 19
Session: 5421704126212138168
    *****************Disconnected from :rtsp://quicktime.uvm.edu:1554/waw/wd
i05hs2b.mov
Sending Requests In Play Success
RTCP Info ▓▓▓▓▓▓▓▓▓▓
RtcpBytes Sent: 9896
Rtcp Packets Sent: 294
RtcpBytes Recieved: 8232
Rtcp Packets Recieved: 294
RTP Info▓▓▓▓▓▓▓▓▓▓▓▓
Rtp Packets Recieved: 8083
Encountered Frames with missing packets: 0
Encountered Empty Frames: 0
Total Frames: 0
Frames still missing packets: 0
RTSP Info▓▓▓▓▓▓▓▓▓▓▓
Rtsp Requests Sent: 19
Rtsp Requests Pushed: 0
Rtsp Requests Retransmitted: 0
Rtsp Responses Receieved: 18
Rtsp Missing : 1
Rtsp Last Message Round Trip Time : 00:00:00
Rtsp Last Server Delay : -00:00:00.0010000
Rtsp Interleaved: 0
"
Marked as answer by juliusfriedman on 3/25/2015 at 8:18 AM
Coordinator
Mar 25, 2015 at 3:18 PM
With that also being said, if you can produce a code sample which exhibits the same activity as indicated in your Wireshark capture I will attempt to verify such and make a fix if required.

Thank you and sorry for any inconvenience.
Coordinator
Mar 25, 2015 at 8:29 PM
This problem is probably related to the Poll Timeout, I just saw that I hand't removed the multiplication of 10 from the Poll call.

I will see about getting an updated release for this tonight.

Until then you can actually just remove the * 10 seen in the RtspClient when polling is used for now.

Thank you and sorry for any inconvenience.
Marked as answer by juliusfriedman on 3/25/2015 at 1:29 PM
Coordinator
Mar 26, 2015 at 12:55 AM
Latest release is up, there will probably be other issues you do find.

Please let me know and thanks!
Mar 26, 2015 at 12:57 AM
I tried your suggestion but it didn't help. Please check whether I did it correctly:
(also added 2 logging statements)
Console.WriteLine("Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: "
 + message.MethodString + DateTime.Now.ToString("  HH:mm:ss"));

if (m_RtspSocket != null && m_RtspSocket.Poll((int)Math.Round(Media.Common.Extensions.TimeSpan.TimeSpanExtensions.TotalMicroseconds(m_RtspSessionTimeout) / Media.Common.Extensions.TimeSpan.TimeSpanExtensions.NanosecondsPerMillisecond, MidpointRounding.ToEven), SelectMode.SelectWrite))
        {
             sent += m_RtspSocket.Send(buffer, sent, length - sent, SocketFlags.None, out error);

             Console.WriteLine("!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: "
             + message.MethodString +      DateTime.Now.ToString("  HH:mm:ss"));
         }
Tried with TCP:
TestRtspKeepalive with added logging and 10x removed. TCP

!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: OPTIONS 17:29:52
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: OPTIONS 17:29:52
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: DESCRIBE 17:29:53
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: DESCRIBE 17:29:53
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: SETUP 17:29:53
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: SETUP 17:29:53
!!-- m_RtspSessionTimeout: 00:01:00
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: SETUP 17:29:53
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: SETUP 17:29:53
!!-- m_RtspSessionTimeout: 00:01:00
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: PLAY 17:29:53
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: PLAY 17:29:53
!!-- m_RtspSessionTimeout: 00:01:00
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:30:23
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:30:23
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:30:53
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:30:53
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:31:23
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:31:23
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:31:53
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:31:53
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:32:23
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:32:23
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:32:53
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:32:53
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:33:23
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:33:23
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:33:53
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:33:53
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:34:23
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:34:23
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:34:53
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:34:53

And with Udp:
TestRtspKeepalive with added logging and 10x removed UDP.

!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: OPTIONS 17:23:20
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: OPTIONS 17:23:20
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: DESCRIBE 17:23:20
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: DESCRIBE 17:23:20
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: SETUP 17:23:20
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: SETUP 17:23:20
!!-- m_RtspSessionTimeout: 00:01:00
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: SETUP 17:23:20
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: SETUP 17:23:20
!!-- m_RtspSessionTimeout: 00:01:00
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: PLAY 17:23:20
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: PLAY 17:23:21
!!-- m_RtspSessionTimeout: 00:01:00
!!-- Calling if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:23:51
!!-- Sent SelectMode.SelectWrite. if(m_RtspSocket != null && m_RtspSocket.Poll...) for Rtsp message method: GET_PARAMETER 17:23:51

As you can see with TCP the keep-alives are sent every 30 seconds.
But with Udp, Only one keep-alive is sent.

My application uses only Udp for the media streams, so this appears to be a clue to the problem.
If you'd like I'll trace backwards through the flow and find out where the Tcp and Udp behaviors diverge, but hopefully this clue will lead you to an aha moment. :-)
Mar 26, 2015 at 1:14 AM
Forgot to include the test program. This is the complete code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Media;
using Media.Rtsp;
using Media.Rtp;
using Media.Rtcp;

namespace TestRtspKeepalive
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Net.NetworkCredential cred = new System.Net.NetworkCredential("admin", "A70212295"); // hikvision
            RtspClient rtspClient = new RtspClient("rtsp://admin:A70212295@192.168.0.148:554/cam1/mpeg4", RtspClient.ClientProtocolType.Tcp, 128 * 1024);

            rtspClient.Credential = cred;
            rtspClient.AuthenticationScheme = System.Net.AuthenticationSchemes.Digest;
            rtspClient.OnPlay += (senders, argss) =>
            {
                if (argss != null)
                {
                    Console.WriteLine("\t*****************Playing `" + argss.ToString() + "`");                    
                    return;
                }
            };
            rtspClient.StartPlaying();
        }
    }
}
Coordinator
Mar 26, 2015 at 1:17 AM
Thanks, is this with the latest code ? If you could also indicate what version of the source your using it would be helpful.

Thanks again for your time.
Marked as answer by juliusfriedman on 3/25/2015 at 6:17 PM
Mar 26, 2015 at 1:23 AM
These results are with 111202. I'll try the new one.
Coordinator
Apr 1, 2015 at 3:49 PM
It seems discussion is back, please let me know if you are still having problems!

Thanks for the testing and feedback!
Marked as answer by juliusfriedman on 4/1/2015 at 8:49 AM
Apr 2, 2015 at 3:53 PM
I have a workaround as explained in my private email.
So I'm ok for now.

Thanks.
Coordinator
Apr 2, 2015 at 6:33 PM
Cool, thanks for the update!

Last question, Were there any specific features in the latest version which you require or are you using the latest version just because?

Just trying to gauge why this release seem to be more popular than the previous stable release :)

Thanks for the continued testing!
Marked as answer by juliusfriedman on 4/2/2015 at 8:12 PM