[FFmpeg-cvslog] shorten: only calculate output size when returning decoded samples, otherwise

Justin Ruggles git at videolan.org
Fri Oct 21 02:37:08 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Wed Sep 14 18:54:42 2011 -0400| [0f97c5014b63f94ebffeb3b0f48c21bbe77b11f3] | committer: Justin Ruggles

shorten: only calculate output size when returning decoded samples, otherwise
just set data_size to zero.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f97c5014b63f94ebffeb3b0f48c21bbe77b11f3
---

 libavcodec/shorten.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 62cead4..a4313ae 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -385,6 +385,7 @@ static int shorten_decode_frame(AVCodecContext *avctx,
         int ret;
         if ((ret = read_header(s)) < 0)
             return ret;
+        *data_size = 0;
     }
     else
     {
@@ -423,8 +424,9 @@ static int shorten_decode_frame(AVCodecContext *avctx,
                     break;
                 }
                 case FN_QUIT:
-                    goto frame_done;
+                    break;
             }
+            *data_size = 0;
         } else {
             /* process audio command */
             int residual_size = 0;
@@ -510,12 +512,12 @@ static int shorten_decode_frame(AVCodecContext *avctx,
             if (s->cur_chan == s->channels) {
                 samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded);
                 s->cur_chan = 0;
-                goto frame_done;
+                *data_size = (int8_t *)samples - (int8_t *)data;
+            } else {
+                *data_size = 0;
             }
         }
     }
-frame_done:
-    *data_size = (int8_t *)samples - (int8_t *)data;
 
     //    s->last_blocksize = s->blocksize;
     s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8);



More information about the ffmpeg-cvslog mailing list