[FFmpeg-cvslog] rtmpproto: Print the error code string if there's no description

Martin Storsjö git at videolan.org
Fri Oct 4 13:52:57 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Oct  3 07:44:51 2013 +0200| [a6b361325f2bfc8d9d4e5f761d6c1a07b209c4fb] | committer: Martin Storsjö

rtmpproto: Print the error code string if there's no description

On (certain streams/setups at least on) Red5, the description string
actually is present, but empty. Therefore, first try loading the
description, but if not found or empty, load the code string instead.
The code string is quite understandable in most cases anyway (like
"NetStream.Play.StreamNotFound").

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6b361325f2bfc8d9d4e5f761d6c1a07b209c4fb
---

 libavformat/rtmpproto.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 91f9b1c..52dc45f 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -2018,8 +2018,12 @@ static int handle_invoke_status(URLContext *s, RTMPPacket *pkt)
 
     t = ff_amf_get_field_value(ptr, data_end, "level", tmpstr, sizeof(tmpstr));
     if (!t && !strcmp(tmpstr, "error")) {
-        if (!ff_amf_get_field_value(ptr, data_end,
-                                    "description", tmpstr, sizeof(tmpstr)))
+        t = ff_amf_get_field_value(ptr, data_end,
+                                   "description", tmpstr, sizeof(tmpstr));
+        if (t || !tmpstr[0])
+            t = ff_amf_get_field_value(ptr, data_end, "code",
+                                       tmpstr, sizeof(tmpstr));
+        if (!t)
             av_log(s, AV_LOG_ERROR, "Server error: %s\n", tmpstr);
         return -1;
     }



More information about the ffmpeg-cvslog mailing list