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

spyfeng subversion at mplayerhq.hu
Sun May 23 17:05:20 CEST 2010


Author: spyfeng
Date: Sun May 23 17:05:20 2010
New Revision: 5815

Log:
check return result in case of possible infinite loop.

Modified:
   mms/mmst.c

Modified: mms/mmst.c
==============================================================================
--- mms/mmst.c	Sun May 23 06:05:46 2010	(r5814)
+++ mms/mmst.c	Sun May 23 17:05:20 2010	(r5815)
@@ -513,12 +513,13 @@ static int read_mms_packet(MMSContext *m
                    size_to_copy, mms->asf_header_size - mms->asf_header_read_pos);
             av_freep(&mms->asf_header);
         } else if(mms->remaining_in_len) {
-            /* Read from media packet buffer */
+            /* Read remaining packet data to buffer.
+             * the result can not be zero because remaining_in_len is positive.*/
             result = read_data(mms, buf, buf_size);
         } else {
             /* Read from network */
             int err = mms_safe_send_recv(mms, NULL, SC_PKT_ASF_MEDIA);
-            if (!err) {
+            if (err == 0) {
                 if(mms->remaining_in_len>mms->asf_packet_len) {
                     dprintf(NULL, "Incoming packet"
                             "larger than the asf packet size stated (%d>%d)\n",
@@ -527,7 +528,14 @@ static int read_mms_packet(MMSContext *m
                 } else {
                     // copy the data to the packet buffer.
                     result = read_data(mms, buf, buf_size);
+                    if (result == 0) {
+                        dprintf(NULL, "read asf media paket size is zero!\n");
+                        break;
+                    }
                 }
+            } else {
+                dprintf(NULL, "read packet error!\n");
+                break;
             }
         }
     } while(!result); // only return one packet.


More information about the FFmpeg-soc mailing list