gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1788-g6e68759
Date: Mon, 09 Sep 2013 13:52:28 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  6e6875931a44b2dc33bca2195871948c0a8e7988 (commit)
      from  db6268172bdb1bf5ab0fb3d03425d0ed7c7b65cf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=6e6875931a44b2dc33bca2195871948c0a8e7988


commit 6e6875931a44b2dc33bca2195871948c0a8e7988
Author: Sandro Santilli <address@hidden>
Date:   Mon Sep 9 15:50:25 2013 +0200

    Use ScopedPtr to manage ffmpeg allocated decoded audio buffer
    
    Thanks Bastiaan for the suggestion

diff --git a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp 
b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
index 4a3a9b0..e53e211 100644
--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
@@ -27,6 +27,7 @@
 #include "FLVParser.h"
 #include "SoundInfo.h"
 #include "MediaParser.h" // for AudioInfo
+#include "GnashScopedPtr.h"
 
 //#define GNASH_DEBUG_AUDIO_DECODING
 
@@ -498,14 +499,14 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* 
input,
     size_t outSize = MAX_AUDIO_FRAME_SIZE;
 
     // TODO: make this a private member, to reuse (see NetStreamFfmpeg in 
0.8.3)
-    boost::int16_t* outPtr = 
reinterpret_cast<boost::int16_t*>(av_malloc(outSize));
-    if (!outPtr) {
+    gnash::ScopedPtr<boost::int16_t> output( 
reinterpret_cast<boost::int16_t*>(av_malloc(outSize)), av_free );
+    if (!output.get()) {
         log_error(_("failed to allocate audio buffer."));
         outputSize = 0;
         return NULL;
     }
 
-    boost::int16_t* output = outPtr;
+    boost::int16_t* outPtr = output.get();
 
 
 #ifdef GNASH_DEBUG_AUDIO_DECODING
@@ -523,7 +524,6 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* input,
     AVFrame *frm = avcodec_alloc_frame();
     if (!frm) {
         log_error(_("failed to allocate frame."));
-        av_free(output);
         return NULL;
     }
     int tmp = avcodec_decode_audio4(_audioCodecCtx, frm, &got_frm, &pkt);
@@ -543,7 +543,6 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* input,
         if (static_cast<int>(outSize) < data_size) {
             log_error(_("output buffer size is too small for the current frame 
"
                 "(%d < %d)"), outSize, data_size);
-            av_free(output);
             return NULL;
         }
 
@@ -575,7 +574,6 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* input,
         log_error(_("Upgrading ffmpeg/libavcodec might fix this issue."));
         outputSize = 0;
         av_freep(&frm);
-        av_free(output);
         return NULL;
     }
 
@@ -651,7 +649,6 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* input,
     }
 
     outputSize = outSize;
-    av_free(output);
     return reinterpret_cast<uint8_t*>(outPtr);
 }
 

-----------------------------------------------------------------------

Summary of changes:
 libmedia/ffmpeg/AudioDecoderFfmpeg.cpp |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]