[FFmpeg-soc] [soc]: r5791 - mms/mmst.c

spyfeng subversion at mplayerhq.hu
Tue May 11 18:02:29 CEST 2010


Author: spyfeng
Date: Tue May 11 18:02:29 2010
New Revision: 5791

Log:
modify the condition to check unexpected packet type,
because some situation doesn't mean wrong workflow.
In a word, make it more robust.

Modified:
   mms/mmst.c

Modified: mms/mmst.c
==============================================================================
--- mms/mmst.c	Tue May 11 17:02:06 2010	(r5790)
+++ mms/mmst.c	Tue May 11 18:02:29 2010	(r5791)
@@ -340,15 +340,6 @@ static MMSSCPacketType get_tcp_server_re
             return packet_type;
         }
     }
-
-    if (packet_type == SC_PKT_KEEPALIVE) {
-        send_keepalive_packet(mms);
-    } else if (packet_type == SC_PKT_STREAM_CHANGING) {
-        handle_packet_stream_changing_type(mms);
-        //TODO: Handle new header when change the stream type.
-    } else if (packet_type == SC_PKT_ASF_MEDIA) {
-        pad_media_packet(mms);
-    }
     return packet_type;
 }
 
@@ -364,11 +355,26 @@ static int mms_safe_send_recv(MMSContext
             return ret;
         }
     }
-    if((type = get_tcp_server_response(mms)) != expect_type) {
-        dprintf(NULL,"Unhandled packet type %d\n", type);
-        return -1;
+
+recv_again:
+    type = get_tcp_server_response(mms);
+    if (type != expect_type) {
+        if (type == SC_PKT_KEEPALIVE) {
+            send_keepalive_packet(mms);
+            goto recv_again;
+        } else if (type == SC_PKT_STREAM_CHANGING) {
+            handle_packet_stream_changing_type(mms);
+            //TODO: Handle new header when change the stream type.
+            return -1;
+        } else {
+            dprintf(NULL,"Unhandled packet type %d\n", type);
+            return -1;
+        }
+    } else {
+        if (type == SC_PKT_ASF_MEDIA)
+            pad_media_packet(mms);
+        return 0;
     }
-    return 0;
 }
 
 static int send_media_header_request(MMSContext *mms)


More information about the FFmpeg-soc mailing list