gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/asobj/NetStreamFfmpeg.cpp


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/NetStreamFfmpeg.cpp
Date: Mon, 12 May 2008 13:10:12 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/05/12 13:10:11

Modified files:
        .              : ChangeLog 
        server/asobj   : NetStreamFfmpeg.cpp 

Log message:
        stop touching m_imageframe from decoder thread.
        No more need to lock mutexes, should fix a deadlock.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6591&r2=1.6592
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.123&r2=1.124

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6591
retrieving revision 1.6592
diff -u -b -r1.6591 -r1.6592
--- ChangeLog   12 May 2008 11:54:35 -0000      1.6591
+++ ChangeLog   12 May 2008 13:10:08 -0000      1.6592
@@ -1,5 +1,10 @@
 2008-05-12 Sandro Santilli <address@hidden>
 
+       * server/asobj/NetStreamFfmpeg.cpp: stop touching m_imageframe from
+         decoder thread. No more need to lock mutexes, should fix a deadlock.
+
+2008-05-12 Sandro Santilli <address@hidden>
+
        * server/asobj/NetStreamFfmpeg.{cpp,h}: use a conditional in
          av_streamer to wait till more frames are needed, signal
          the condition from refreshVideoFrame and audio_streamer

Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -b -r1.123 -r1.124
--- server/asobj/NetStreamFfmpeg.cpp    12 May 2008 11:54:37 -0000      1.123
+++ server/asobj/NetStreamFfmpeg.cpp    12 May 2008 13:10:10 -0000      1.124
@@ -90,6 +90,7 @@
 {
        if ( _decoderBuffer ) delete [] _decoderBuffer;
        close();
+       delete m_imageframe;
 }
 
 
@@ -166,20 +167,8 @@
                m_FormatCtx = NULL;
        }
 
-       {
-#ifdef GNASH_DEBUG_THREADS
-               log_debug("image_mutex: waiting for lock in close");
-#endif
-               boost::mutex::scoped_lock lock(image_mutex);
-#ifdef GNASH_DEBUG_THREADS
-               log_debug("image_mutex: lock obtained in close");
-#endif
                delete m_imageframe;
                m_imageframe = NULL;
-#ifdef GNASH_DEBUG_THREADS
-               log_debug("image_mutex: releasing lock in close");
-#endif
-       }
        delete m_unqueued_data;
        m_unqueued_data = NULL;
 
@@ -583,30 +572,6 @@
        // Allocate a frame to store the decoded frame in
        m_Frame = avcodec_alloc_frame();
 
-       {
-#ifdef GNASH_DEBUG_THREADS
-               log_debug("image_mutex: waiting for lock in startPlayback");
-#endif
-               boost::mutex::scoped_lock lock(image_mutex);
-#ifdef GNASH_DEBUG_THREADS
-               log_debug("image_mutex: lock obtained in startPlayback");
-#endif
-
-               // Determine required buffer size and allocate buffer
-               if (m_videoFrameFormat == render::YUV)
-               {
-                       m_imageframe = new image::yuv(m_VCodecCtx->width,       
m_VCodecCtx->height);
-               }
-               else if (m_videoFrameFormat == render::RGB)
-               {
-                       m_imageframe = new image::rgb(m_VCodecCtx->width,       
m_VCodecCtx->height);
-               }
-
-#ifdef GNASH_DEBUG_THREADS
-               log_debug("image_mutex: releasing lock in startPlayback");
-#endif
-       }
-
        if ( m_audio_index >= 0 && _soundHandler )
        {
                // Get a pointer to the audio codec context for the video stream
@@ -1003,17 +968,16 @@
        avcodec_decode_video(m_VCodecCtx, m_Frame, &got, packet->data, 
packet->size);
        if (!got) return false;
 
-
-       if (m_imageframe == NULL)
-       {
+       // This tmpImage is really only used to compute proper size of the 
video data...
+       // stupid isn't it ?
+       std::auto_ptr<image::image_base> tmpImage;
                if (m_videoFrameFormat == render::YUV)
                {
-                       m_imageframe = new image::yuv(m_VCodecCtx->width, 
m_VCodecCtx->height);
+               tmpImage.reset( new image::yuv(m_VCodecCtx->width, 
m_VCodecCtx->height) );
                }
                else if (m_videoFrameFormat == render::RGB)
                {
-                       m_imageframe = new image::rgb(m_VCodecCtx->width, 
m_VCodecCtx->height);
-               }
+               tmpImage.reset( new image::rgb(m_VCodecCtx->width, 
m_VCodecCtx->height) );
        }
 
        AVPicture rgbpicture;
@@ -1036,25 +1000,13 @@
                rgbpicture = 
media::VideoDecoderFfmpeg::convertRGB24(m_VCodecCtx, *m_Frame);
                if (!rgbpicture.data[0])
                {
-#ifdef GNASH_DEBUG_THREADS
-                       log_debug("image_mutex: releasing lock in decodeVideo");
-#endif
                        return false;
                }
        }
 
        media::raw_mediadata_t* video = new media::raw_mediadata_t();
 
-       if (m_videoFrameFormat == render::YUV)
-       {
-               video->m_data = new 
boost::uint8_t[static_cast<image::yuv*>(m_imageframe)->size()];
-       }
-       else if (m_videoFrameFormat == render::RGB)
-       {
-               image::rgb* tmp = static_cast<image::rgb*>(m_imageframe);
-               video->m_data = new boost::uint8_t[tmp->pitch() * 
tmp->height()];
-       }
-
+       video->m_data = new boost::uint8_t[tmpImage->size()];
        video->m_ptr = video->m_data;
        video->m_stream_index = m_video_index;
        video->m_pts = 0;
@@ -1088,7 +1040,7 @@
 
        if (m_videoFrameFormat == render::YUV)
        {
-               image::yuv* yuvframe = static_cast<image::yuv*>(m_imageframe);
+               image::yuv* yuvframe = static_cast<image::yuv*>(tmpImage.get());
                unsigned int copied = 0;
                boost::uint8_t* ptr = video->m_data;
                for (int i = 0; i < 3 ; i++)
@@ -1143,10 +1095,6 @@
        if (m_isFLV) m_qvideo.push(video);
        else m_unqueued_data = m_qvideo.push(video) ? NULL : video;
 
-#ifdef GNASH_DEBUG_THREADS
-       log_debug("image_mutex: releasing lock in decodeVideo");
-#endif
-
        return true;
 }
 
@@ -1350,24 +1298,15 @@
                if (current_clock >= video_clock)
                {
 
-#ifdef GNASH_DEBUG_THREADS
-                       log_debug("image_mutex: waiting for lock in 
refreshVideoFrame");
-#endif
-
-                       boost::mutex::scoped_lock lock(image_mutex);
-
-#ifdef GNASH_DEBUG_THREADS
-                       log_debug("image_mutex: lock obtained in 
refreshVideoFrame");
-#endif
-
                        if (m_videoFrameFormat == render::YUV)
                        {
+                               if ( ! m_imageframe ) m_imageframe  = new 
image::yuv(m_VCodecCtx->width, m_VCodecCtx->height);
                                // XXX m_imageframe might be a byte aligned 
buffer, while video is not!
                                
static_cast<image::yuv*>(m_imageframe)->update(video->m_data);
                        }
                        else if (m_videoFrameFormat == render::RGB)
                        {
-
+                               if ( ! m_imageframe ) m_imageframe  = new 
image::rgb(m_VCodecCtx->width, m_VCodecCtx->height);
                                image::rgb* imgframe = 
static_cast<image::rgb*>(m_imageframe);
                                rgbcopy(imgframe, video, m_VCodecCtx->width * 
3);
                        }
@@ -1383,9 +1322,6 @@
                        // A frame is ready for pickup
                        m_newFrameReady = true;
 
-#ifdef GNASH_DEBUG_THREADS
-                       log_debug("image_mutex: releasing lock in 
refreshVideoFrame");
-#endif
                }
                else
                {




reply via email to

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