[rtmpdump] SIGINT ignored when no A/V data received

Skaarj NaPali skaarj1 at gmail.com
Sun Aug 22 13:02:09 CEST 2010

Rtmpdump can not get exited with "Ctrl+C" in case the server does not
send any audio/video data and instead of this keeps sending only
control data. There are scenarios where a server may not send any
audio/video (e.g. bad server configuration, bad playpath, etc.) In hat
case the server will though keep sending RTMP control data which leads
to that there will never be a socket timeout error and rtmpdump keeps
running. The problem here is that this instance of rtmpdump can not
get exited by "Ctrl+C" even because the "RTMP_ctrlC" flag is not
evaluated at all.

To solve this problem the according check could get added to
"RTMPSockBuf_Fill" as shown below:

RTMPSockBuf_Fill(RTMPSockBuf *sb)
    int nBytes;

    if (!sb->sb_size)
        sb->sb_start = sb->sb_buf;

    while (1)
        nBytes = sizeof(sb->sb_buf) - sb->sb_size - (sb->sb_start - sb->sb_buf);
#if defined(CRYPTO) && !defined(NO_SSL)
        if (sb->sb_ssl)
            nBytes = TLS_read(sb->sb_ssl, sb->sb_start + sb->sb_size, nBytes);
            nBytes = recv(sb->sb_socket, sb->sb_start + sb->sb_size, nBytes, 0);
//Need to check 'Ctrl-C' here as well.
        if (RTMP_ctrlC) {
            nBytes = -1;
        if (nBytes != -1)

More information about the rtmpdump mailing list