[rtmpdump] Wrong download state in case of "Play.Complete" or "Play.Stop".

Skaarj NaPali skaarj1 at gmail.com
Sun Aug 22 12:46:47 CEST 2010

If a server sends a "Play.Complete" or "Play.Stop" and if that server
does not send a "close" afterwards (happens quite often with the
servers I am dealing with), the download state and thus the exit code
of rtmpdump is wrongly set to RD_INCOMPLETE. This is because the code
is assuming that a server will always send a "close" after a
"Play.Complete" or "Play.Stop". Well, in practice they do not.

To solve this problem, the following code can get added to the
"Download" function of "rtmpdump"

... // If we received 'Play.Complete' or 'Play.Stop', treat it as success.
    if (nRead == 0 && rtmp->m_read.status == RTMP_READ_COMPLETE)
        return RD_SUCCESS;

    if ((duration > 0 && *percent < 99.9) || RTMP_ctrlC || nRead < 0
        || RTMP_IsTimedout(rtmp))
        return RD_INCOMPLETE;

    return RD_SUCCESS;

More information about the rtmpdump mailing list