aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2012-08-11 12:42:17 +0200
committerMartin Storsjö <martin@martin.st>2012-08-14 22:36:35 +0300
commitfb7e78089bf04aa73ba53972e8261bf0bbbb121a (patch)
tree3f7416601e0d1ed9b774cf3467ec657ee3602cc5
parent8b6a5a7923dc4596091acaa9d8219ade39dd2d61 (diff)
downloadffmpeg-fb7e78089bf04aa73ba53972e8261bf0bbbb121a.tar.gz
rtmp: Gracefully ignore _checkbw errors by tracking them
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/rtmpproto.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 150e45a363..a90d9dadb3 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -629,7 +629,7 @@ static int gen_check_bw(URLContext *s, RTMPContext *rt)
ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_null(&p);
- return rtmp_send_packet(rt, &pkt, 0);
+ return rtmp_send_packet(rt, &pkt, 1);
}
/**
@@ -1055,15 +1055,27 @@ static int handle_server_bw(URLContext *s, RTMPPacket *pkt)
static int handle_invoke_error(URLContext *s, RTMPPacket *pkt)
{
const uint8_t *data_end = pkt->data + pkt->data_size;
+ char *tracked_method = NULL;
+ int level = AV_LOG_ERROR;
uint8_t tmpstr[256];
+ int ret;
+
+ if ((ret = find_tracked_method(s, pkt, 9, &tracked_method)) < 0)
+ return ret;
if (!ff_amf_get_field_value(pkt->data + 9, data_end,
"description", tmpstr, sizeof(tmpstr))) {
- av_log(s, AV_LOG_ERROR, "Server error: %s\n", tmpstr);
- return -1;
+ if (tracked_method && !strcmp(tracked_method, "_checkbw")) {
+ /* Ignore _checkbw errors. */
+ level = AV_LOG_WARNING;
+ ret = 0;
+ } else
+ ret = -1;
+ av_log(s, level, "Server error: %s\n", tmpstr);
}
- return 0;
+ av_free(tracked_method);
+ return ret;
}
static int handle_invoke_result(URLContext *s, RTMPPacket *pkt)