shithub: libvpx

Download patch

ref: b59e37e1aa17deef530f18939f79fe4138d20712
parent: 92ebef119ac27babc547e9b86470b435d96b1e94
parent: b92eb54106ed923885b8e2223575b791cb12fe6a
author: Vignesh Venkatasubramanian <[email protected]>
date: Wed Apr 16 05:47:24 EDT 2014

Merge "webmdec: Fix return values for webm_read_frame"

--- a/webmdec.c
+++ b/webmdec.c
@@ -115,6 +115,7 @@
                     size_t *buffer_size) {
   if (webm_ctx->chunk >= webm_ctx->chunks) {
     uint32_t track;
+    int status;
 
     do {
       /* End of this packet, get another. */
@@ -123,14 +124,16 @@
         webm_ctx->pkt = NULL;
       }
 
-      if (nestegg_read_packet(webm_ctx->nestegg_ctx, &webm_ctx->pkt) <= 0 ||
-          nestegg_packet_track(webm_ctx->pkt, &track)) {
-        return 1;
-      }
+      status = nestegg_read_packet(webm_ctx->nestegg_ctx, &webm_ctx->pkt);
+      if (status <= 0)
+        return status ? status : 1;
+
+      if (nestegg_packet_track(webm_ctx->pkt, &track))
+        return -1;
     } while (track != webm_ctx->video_track);
 
     if (nestegg_packet_count(webm_ctx->pkt, &webm_ctx->chunks))
-      return 1;
+      return -1;
 
     webm_ctx->chunk = 0;
   }
@@ -137,7 +140,7 @@
 
   if (nestegg_packet_data(webm_ctx->pkt, webm_ctx->chunk,
                           buffer, bytes_in_buffer)) {
-    return 1;
+    return -1;
   }
 
   webm_ctx->chunk++;
--- a/webmdec.h
+++ b/webmdec.h
@@ -31,6 +31,11 @@
 int file_is_webm(struct WebmInputContext *webm_ctx,
                  struct VpxInputContext *vpx_ctx);
 
+/* Reads a WebM video frame. Return values:
+ *   0 - Success
+ *   1 - End of File
+ *  -1 - Error
+ */
 int webm_read_frame(struct WebmInputContext *webm_ctx,
                     uint8_t **buffer,
                     size_t *bytes_in_buffer,