[rtmpdump] r209 - trunk/rtmpdump.c
hyc
subversion at mplayerhq.hu
Fri Jan 8 05:53:40 CET 2010
Author: hyc
Date: Fri Jan 8 05:53:39 2010
New Revision: 209
Log:
Fallback to Reconnect if ToggleStream didn't work, then give up if both fail
Modified:
trunk/rtmpdump.c
Modified: trunk/rtmpdump.c
==============================================================================
--- trunk/rtmpdump.c Fri Jan 8 05:28:15 2010 (r208)
+++ trunk/rtmpdump.c Fri Jan 8 05:53:39 2010 (r209)
@@ -1082,6 +1082,7 @@ main(int argc, char **argv)
AVal subscribepath = { 0, 0 };
int port = -1;
int protocol = RTMP_PROTOCOL_UNDEFINED;
+ int retries = 0;
bool bLiveStream = false; // is it a live stream? then we can't seek/resume
bool bHashes = false; // display byte counters not hashes by default
@@ -1663,8 +1664,43 @@ main(int argc, char **argv)
{
nInitialFrameSize = 0;
+ if (retries)
+ {
+ Log(LOGERROR, "Failed to resume the stream\n\n");
+ if (!RTMP_IsTimedout(&rtmp))
+ nStatus = RD_FAILED;
+ else
+ nStatus = RD_INCOMPLETE;
+ break;
+ }
Log(LOGINFO, "Connection timed out, trying to resume.\n\n");
- if (!RTMP_ToggleStream(&rtmp))
+ /* Did we already try pausing, and it still didn't work? */
+ if (rtmp.m_pausing == 3)
+ {
+ /* Only one try at reconnecting... */
+ retries = 1;
+ dSeek = rtmp.m_pauseStamp;
+ if (dStopOffset > 0)
+ {
+ dLength = dStopOffset - dSeek;
+ if (dLength <= 0)
+ {
+ LogPrintf("Already Completed\n");
+ nStatus = RD_SUCCESS;
+ break;
+ }
+ }
+ if (!RTMP_ReconnectStream(&rtmp, bufferTime, dSeek, dLength))
+ {
+ Log(LOGERROR, "Failed to resume the stream\n\n");
+ if (!RTMP_IsTimedout(&rtmp))
+ nStatus = RD_FAILED;
+ else
+ nStatus = RD_INCOMPLETE;
+ break;
+ }
+ }
+ else if (!RTMP_ToggleStream(&rtmp))
{
Log(LOGERROR, "Failed to resume the stream\n\n");
if (!RTMP_IsTimedout(&rtmp))
More information about the rtmpdump
mailing list