These messages are Adobe-specific historical artifacts that some RTMP
servers do not support. It is safer to ignore their failure. This fixes
publishing streams to crtmpserver and it fixes Bugzilla bug #309.
---
libavformat/rtmpproto.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 5c40eb5..1458a71 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -877,8 +877,22 @@ static int rtmp_parse_result(URLContext *s, RTMPContext
*rt, RTMPPacket *pkt)
uint8_t tmpstr[256];
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);
+ "description", tmpstr,
sizeof(tmpstr))) {
+ if (!rt->is_input) {
+ uint8_t codestr[256];
+
+ t = ff_amf_get_field_value(pkt->data, data_end,
+ "code", codestr,
sizeof(codestr));
+ if (!t && !strcmp(codestr, "NetConnection.Call.Failed")) {
+ /* Hack for crtmpserver, these messages are
+ * Adobe-specific historical artifacts that
+ * some RTMP servers do not support. It is
+ * safer to ignore their failure. */
+ break;
+ }
+ }
+ av_log(s, AV_LOG_ERROR, "Server error: %s\n", tmpstr);
+ }
return -1;
} else if (!memcmp(pkt->data, "\002\000\007_result", 10)) {
switch (rt->state) {
@@ -957,6 +971,18 @@ static int rtmp_parse_result(URLContext *s, RTMPContext
*rt, RTMPPacket *pkt)
} else if (!memcmp(pkt->data, "\002\000\010onBWDone", 11)) {
if ((ret = gen_check_bw(s, rt)) < 0)
return ret;
+ } else if (!memcmp(pkt->data, "\002\000\013onFCPublish", 11)) {
+ uint8_t tmpstr[256];
+
+ if (rt->state != STATE_FCPUBLISH)
+ break;
+
+ /* crtmpserver sends an invoke packet in order to inform
+ * the client that the stream can be published. */
+ t = ff_amf_get_field_value(pkt->data, data_end,
+ "code", tmpstr, sizeof(tmpstr));
+ if (!t && !strcmp(tmpstr, "NetStream.Publish.Start"))
+ rt->state = STATE_CONNECTING;
}
break;
case RTMP_PT_VIDEO:
--
1.7.11.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel