gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libmedia/ffmpeg/VideoDecoderFfm... [gnash


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog libmedia/ffmpeg/VideoDecoderFfm... [gnash_0_8_3_branch]
Date: Tue, 13 May 2008 23:57:42 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         gnash_0_8_3_branch
Changes by:     Bastiaan Jacques <bjacques>     08/05/13 23:57:42

Modified files:
        .              : ChangeLog 
        libmedia/ffmpeg: VideoDecoderFfmpeg.cpp 
        server/asobj   : NetStream.cpp NetStream.h NetStreamFfmpeg.cpp 

Log message:
                * server/asobj/NetStream.{h,cpp,Ffmpeg.cpp}: Mutex-protect
                _netCon and m_parser, because they access a curl tu_file
                across threads.
                * libmedia/ffmpeg/VideoDecoderFfmpeg.cpp: Don't neglect to 
return the
                decoded frame in pop().

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.6573.2.5&r2=1.6573.2.6
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.7&r2=1.7.2.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.cpp?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.89&r2=1.89.2.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.h?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.61&r2=1.61.2.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.116.2.1&r2=1.116.2.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6573.2.5
retrieving revision 1.6573.2.6
diff -u -b -r1.6573.2.5 -r1.6573.2.6
--- ChangeLog   12 May 2008 07:59:04 -0000      1.6573.2.5
+++ ChangeLog   13 May 2008 23:57:37 -0000      1.6573.2.6
@@ -1,3 +1,11 @@
+2008-05-13 Bastiaan Jacques <address@hidden>
+
+       * server/asobj/NetStream.{h,cpp,Ffmpeg.cpp}: Mutex-protect 
+       _netCon and m_parser, because they access a curl tu_file 
+       across threads.
+       * libmedia/ffmpeg/VideoDecoderFfmpeg.cpp: Don't neglect to return the
+       decoded frame in pop().
+
 2008-05-12 Robert Millan <address@hidden>
 
        * libbase/: Makefile.am, gnashpluginrc.in, gnashrc.in,

Index: libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -b -r1.7 -r1.7.2.1
--- libmedia/ffmpeg/VideoDecoderFfmpeg.cpp      12 Mar 2008 11:18:51 -0000      
1.7
+++ libmedia/ffmpeg/VideoDecoderFfmpeg.cpp      13 May 2008 23:57:40 -0000      
1.7.2.1
@@ -193,12 +193,10 @@
 {
   std::auto_ptr<image::rgb> ret;
 
-  std::for_each(_video_frames.begin(), _video_frames.end(), 
boost::bind(&gnash::media::VideoDecoderFfmpeg::decode, this, _1));
-#if 0
-  BOOST_FOREACH(const EncodedVideoFrame* frame, _video_frames) {
-    ret = decode(frame->data(), frame->dataSize());
+  for (std::vector<const EncodedVideoFrame*>::iterator it =
+       _video_frames.begin(), end = _video_frames.end(); it != end; ++it) {
+     ret = decode((*it)->data(), (*it)->dataSize());
   }
-#endif
 
   _video_frames.clear();
 

Index: server/asobj/NetStream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.cpp,v
retrieving revision 1.89
retrieving revision 1.89.2.1
diff -u -b -r1.89 -r1.89.2.1
--- server/asobj/NetStream.cpp  21 Apr 2008 11:27:44 -0000      1.89
+++ server/asobj/NetStream.cpp  13 May 2008 23:57:40 -0000      1.89.2.1
@@ -533,6 +533,8 @@
 {
        if (m_parser.get() == NULL) return 0;
 
+       boost::mutex::scoped_lock lock(_netcon_mutex);
+
        // m_parser will lock a mutex
        // FLVParser::getBufferLength returns milliseconds already
        return m_parser->getBufferLength();

Index: server/asobj/NetStream.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.h,v
retrieving revision 1.61
retrieving revision 1.61.2.1
diff -u -b -r1.61 -r1.61.2.1
--- server/asobj/NetStream.h    21 Apr 2008 11:27:44 -0000      1.61
+++ server/asobj/NetStream.h    13 May 2008 23:57:41 -0000      1.61.2.1
@@ -85,6 +85,8 @@
        };
        
 
+       boost::mutex _netcon_mutex;
+
        boost::intrusive_ptr<NetConnection> _netCon;
 
        /// Set stream status.

Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.116.2.1
retrieving revision 1.116.2.2
diff -u -b -r1.116.2.1 -r1.116.2.2
--- server/asobj/NetStreamFfmpeg.cpp    11 May 2008 18:39:03 -0000      
1.116.2.1
+++ server/asobj/NetStreamFfmpeg.cpp    13 May 2008 23:57:41 -0000      
1.116.2.2
@@ -183,7 +183,9 @@
 NetStreamFfmpeg::readPacket(void* opaque, boost::uint8_t* buf, int buf_size)
 {
 
+
        NetStreamFfmpeg* ns = static_cast<NetStreamFfmpeg*>(opaque);
+       boost::mutex::scoped_lock lock(ns->_netcon_mutex);
        boost::intrusive_ptr<NetConnection> nc = ns->_netCon;
 
        size_t ret = nc->read(static_cast<void*>(buf), buf_size);
@@ -196,8 +198,8 @@
 offset_t 
 NetStreamFfmpeg::seekMedia(void *opaque, offset_t offset, int whence)
 {
-
        NetStreamFfmpeg* ns = static_cast<NetStreamFfmpeg*>(opaque);
+       boost::mutex::scoped_lock lock(ns->_netcon_mutex);
        boost::intrusive_ptr<NetConnection> nc = ns->_netCon;
 
 
@@ -239,6 +241,9 @@
                return;
        }
 
+       {       
+               boost::mutex::scoped_lock lock(_netcon_mutex);
+
        // Does it have an associated NetConnection ?
        if ( ! _netCon )
        {
@@ -247,6 +252,7 @@
                );
                return;
        }
+       }
 
        if (url.size() == 0) url += c_url;
        // Remove any "mp3:" prefix. Maybe should use this to mark as audio-only
@@ -399,6 +405,7 @@
 bool
 NetStreamFfmpeg::startPlayback()
 {
+       boost::mutex::scoped_lock lock(_netcon_mutex);
 
        boost::intrusive_ptr<NetConnection> nc = _netCon;
        assert(nc);
@@ -575,13 +582,14 @@
        // Determine required buffer size and allocate buffer
        if (m_videoFrameFormat == render::YUV)
        {
-               m_imageframe = new image::yuv(m_VCodecCtx->width,       
m_VCodecCtx->height);
+                       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);
+                       m_imageframe = new image::rgb(m_VCodecCtx->width,
+                                                     m_VCodecCtx->height);
        }
-
        }
 
        media::sound_handler* s = get_sound_handler();
@@ -773,15 +781,19 @@
 bool NetStreamFfmpeg::decodeFLVFrame()
 {
        FLVFrame* frame = NULL;
+       {
+               boost::mutex::scoped_lock lock(_netcon_mutex);
        if ( m_qvideo.size() < m_qaudio.size() ) 
        {
                frame = m_parser->nextVideoFrame();
        } else {
                frame = m_parser->nextAudioFrame();
        }
+       }
 
        if (frame == NULL)
        {
+               boost::mutex::scoped_lock lock(_netcon_mutex);
                if (_netCon->loadCompleted())
                {
 #ifdef GNASH_DEBUG_THREADS
@@ -926,6 +938,7 @@
                }
                else
                {
+                       boost::mutex::scoped_lock lock(_netcon_mutex);
                        frame_delay = m_parser->audioFrameDelay();
                }
 
@@ -1019,7 +1032,10 @@
        // update video clock for next frame
        boost::uint32_t frame_delay;
        if (!m_isFLV) frame_delay = 
static_cast<boost::uint32_t>(as_double(m_video_stream->codec->time_base) * 
1000.0);
-       else frame_delay = m_parser->videoFrameDelay();
+       else {
+               boost::mutex::scoped_lock lock(_netcon_mutex);
+               frame_delay = m_parser->videoFrameDelay();
+       }
 
        // for MPEG2, the frame can be repeated, so we update the clock 
accordingly
        frame_delay += static_cast<boost::uint32_t>(m_Frame->repeat_pict * 
(frame_delay * 0.5) * 1000.0);
@@ -1154,6 +1170,7 @@
        {
                if (m_parser.get())
                {
+                 boost::mutex::scoped_lock lock(_netcon_mutex);
                        newpos = m_parser->seek(pos);
                }
                else
@@ -1314,8 +1331,11 @@
        //    miliseconds).
        // 2) The buffer has be "starved" (not being filled as quickly as 
needed),
        //    and we then wait until the buffer contains some data (1 sec) 
again.
-       if (m_go && m_pause && m_start_onbuffer && m_parser.get() && 
m_parser->isTimeLoaded(m_current_timestamp+m_bufferTime))
-       {
+       if (m_go && m_pause && m_start_onbuffer) {
+
+               boost::mutex::scoped_lock lock(_netcon_mutex);
+    
+               if (m_parser.get() && 
m_parser->isTimeLoaded(m_current_timestamp+m_bufferTime)) {
 #ifdef GNASH_DEBUG_STATUS
                log_debug("(advance): setting buffer full");
 #endif
@@ -1323,6 +1343,7 @@
                unpausePlayback();
                m_start_onbuffer = false;
        }
+       }
 
        //log_debug("(advance): processing status notification, refreshing 
video frame");
 
@@ -1399,6 +1420,8 @@
 {
        long ret_val = 0;
 
+       boost::mutex::scoped_lock lock(_netcon_mutex);
+
        if ( _netCon ) 
        {
                ret_val = _netCon->getBytesLoaded();
@@ -1413,6 +1436,8 @@
 {
        long ret_val = 0;
 
+       boost::mutex::scoped_lock lock(_netcon_mutex);
+    
        if ( _netCon ) 
        {
                ret_val = _netCon->getBytesTotal();




reply via email to

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