changeset 5378:c22a1e94e80f libavformat

When searching for AMF object field value, try to find that object first instead of assuming it should occur right at given position. This helps finding human-readable error descriptions in RTMP server replies.
author kostya
date Sun, 22 Nov 2009 09:03:06 +0000
parents 9313acce85fc
children 13cd610e6ed4
files rtmppkt.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rtmppkt.c	Sun Nov 22 08:42:55 2009 +0000
+++ b/rtmppkt.c	Sun Nov 22 09:03:06 2009 +0000
@@ -233,10 +233,15 @@
     int namelen = strlen(name);
     int len;
 
+    while (*data != AMF_DATA_TYPE_OBJECT && data < data_end) {
+        len = ff_amf_tag_size(data, data_end);
+        if (len < 0)
+            len = data_end - data;
+        data += len;
+    }
     if (data_end - data < 3)
         return -1;
-    if (*data++ != AMF_DATA_TYPE_OBJECT)
-        return -1;
+    data++;
     for (;;) {
         int size = bytestream_get_be16(&data);
         if (!size)