jitter buffer: check for buffer overflow only when zero-copy is off
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Sun, 25 Nov 2007 06:00:34 +0000 (06:00 +0000)
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Sun, 25 Nov 2007 06:00:34 +0000 (06:00 +0000)
git-svn-id: http://svn.xiph.org/trunk/speex@14225 0101bb08-14d6-0310-b084-bc0e0c8e3800

libspeex/jitter.c

index e176eb8..9cefadd 100644 (file)
@@ -588,17 +588,17 @@ int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int3
       }
       
       
-      if (jitter->packets[i].len > packet->len)
-      {
-         speex_warning_int("jitter_buffer_get(): packet too large to fit. Size is", jitter->packets[i].len);
-      } else {
-         packet->len = jitter->packets[i].len;
-      }
       /* Copy packet */
       if (jitter->destroy)
       {
          packet->data = jitter->packets[i].data;
       } else {
+         if (jitter->packets[i].len > packet->len)
+         {
+            speex_warning_int("jitter_buffer_get(): packet too large to fit. Size is", jitter->packets[i].len);
+         } else {
+            packet->len = jitter->packets[i].len;
+         }
          for (j=0;j<packet->len;j++)
             packet->data[j] = jitter->packets[i].data[j];
          /* Remove packet */