[vlc-commits] decklink: simplify callback

Rafaël Carré git at videolan.org
Thu Dec 13 16:57:07 CET 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Dec 11 16:18:29 2012 +0100| [b2f30144388a0249be24ebfdf3580909949f6db9] | committer: Rafaël Carré

decklink: simplify callback

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b2f30144388a0249be24ebfdf3580909949f6db9
---

 modules/access/decklink.cpp |   15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/modules/access/decklink.cpp b/modules/access/decklink.cpp
index 2770f54..fa3c9a1 100644
--- a/modules/access/decklink.cpp
+++ b/modules/access/decklink.cpp
@@ -182,8 +182,6 @@ private:
 HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame* videoFrame, IDeckLinkAudioInputPacket* audioFrame)
 {
     demux_sys_t *sys = demux_->p_sys;
-    block_t *video_frame = NULL;
-    block_t *audio_frame = NULL;
 
     if (videoFrame)
     {
@@ -198,11 +196,9 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
         const int stride = videoFrame->GetRowBytes();
         const int bpp = 2;
 
-        video_frame = block_New(demux_, width * height * bpp);
+        block_t *video_frame = block_New(demux_, width * height * bpp);
         if (!video_frame)
-        {
-            msg_Err(demux_, "Could not allocate memory for video frame");
-        }
+            return S_OK;
 
         void *frame_bytes;
         videoFrame->GetBytes(&frame_bytes);
@@ -231,14 +227,9 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
     {
         const int bytes = audioFrame->GetSampleFrameCount() * sizeof(int16_t) * sys->channels;
 
-        audio_frame = block_New(demux_, bytes);
+        block_t *audio_frame = block_New(demux_, bytes);
         if (!audio_frame)
-        {
-            msg_Err(demux_, "Could not allocate memory for audio frame");
-            if (video_frame)
-                block_Release(video_frame);
             return S_OK;
-        }
 
         void *frame_bytes;
         audioFrame->GetBytes(&frame_bytes);



More information about the vlc-commits mailing list