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.cp...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/NetStreamFfmpeg.cp...
Date: Mon, 12 May 2008 09:20:02 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/05/12 09:20:02

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

Log message:
                * server/asobj/NetStreamFfmpeg.{cpp,h}: complete use of cached
                  sound_handler; add a mutex protecting generic access to the
                  audio/video queues. The mutex will be locked by
                  loader/parser/decoder thread, main thread (refreshVideoFrame)
                  and audio streamer (audio_streamer).
                  The rationale here is that locking on each inspector or 
modifier
                  on the single queue is pretty useless, as code relies on 
cached
                  informations about them, like their size, their composition 
and
                  so on. Should be pretty safe to remove any locking on the
                  multiqueue_threads now (should also change name...) but better
                  postpone this.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6588&r2=1.6589
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.120&r2=1.121
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.h?cvsroot=gnash&r1=1.61&r2=1.62

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6588
retrieving revision 1.6589
diff -u -b -r1.6588 -r1.6589
--- ChangeLog   12 May 2008 09:12:19 -0000      1.6588
+++ ChangeLog   12 May 2008 09:19:58 -0000      1.6589
@@ -1,5 +1,20 @@
 2008-05-12 Sandro Santilli <address@hidden>
 
+       * server/asobj/NetStreamFfmpeg.{cpp,h}: complete use of cached
+         sound_handler; add a mutex protecting generic access to the
+         audio/video queues. The mutex will be locked by
+         loader/parser/decoder thread, main thread (refreshVideoFrame)
+         and audio streamer (audio_streamer).
+         The rationale here is that locking on each inspector or modifier
+         on the single queue is pretty useless, as code relies on cached
+         informations about them, like their size, their composition and
+         so on. Should be pretty safe to remove any locking on the 
+         multiqueue_threads now (should also change name...) but better
+         postpone this.
+
+
+2008-05-12 Sandro Santilli <address@hidden>
+
        * testsuite/misc-ming.all/NetStream-SquareTest.c: have the second
          NetStream play an ogg. This is to help testing both access methods
          from ffmpeg handler, and to keep an eye on ogg support (gstreamer

Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -b -r1.120 -r1.121
--- server/asobj/NetStreamFfmpeg.cpp    12 May 2008 08:58:04 -0000      1.120
+++ server/asobj/NetStreamFfmpeg.cpp    12 May 2008 09:20:01 -0000      1.121
@@ -171,6 +171,8 @@
        delete m_unqueued_data;
        m_unqueued_data = NULL;
 
+       boost::mutex::scoped_lock lock(_qMutex);
+
        m_qvideo.clear();
        m_qaudio.clear();
 
@@ -659,9 +661,9 @@
        else
        {
                // We need to restart the audio
-               if (_soundHandler)
+               if (ns->_soundHandler)
                {
-                       _soundHandler->attach_aux_streamer(audio_streamer, ns);
+                       ns->_soundHandler->attach_aux_streamer(audio_streamer, 
ns);
                }
        }
 
@@ -682,6 +684,8 @@
                log_debug("Decoding iteration. bufferTime=%lu, bufferLen=%lu", 
ns->bufferTime(), ns->bufferLength());
 #endif
 
+               {
+               boost::mutex::scoped_lock lock(ns->_qMutex);
                if (ns->m_isFLV)
                {
                        // If queues are full then don't bother filling it
@@ -717,6 +721,7 @@
                        }
 
                }
+               }
 
                usleep(1000); // Sleep 1ms to avoid busying the processor.
 
@@ -747,6 +752,8 @@
 
        while (len > 0 && ns->m_qaudio.size() > 0)
        {
+               boost::mutex::scoped_lock lock(ns->_qMutex);
+
                media::raw_mediadata_t* samples = ns->m_qaudio.front();
 
                int n = imin(samples->m_size, len);
@@ -1078,6 +1085,7 @@
 
        }
 
+       // NOTE: Caller is assumed to have locked _qMutex already
        if (m_isFLV) m_qvideo.push(video);
        else m_unqueued_data = m_qvideo.push(video) ? NULL : video;
 
@@ -1113,7 +1121,7 @@
 
        if (rc >= 0)
        {
-               if (packet.stream_index == m_audio_index && get_sound_handler())
+               if (packet.stream_index == m_audio_index && _soundHandler)
                {
                        if (!decodeAudio(&packet)) 
                        {
@@ -1235,6 +1243,8 @@
 void
 NetStreamFfmpeg::refreshVideoFrame()
 {
+       boost::mutex::scoped_lock lock(_qMutex);
+
        // If we're paused or not running, there is no need to do this
        if (!m_go || m_pause) return;
 
@@ -1253,7 +1263,7 @@
 
                // Caclulate the current time
                boost::uint32_t current_clock;
-               if (m_ACodecCtx && get_sound_handler())
+               if (m_ACodecCtx && _soundHandler)
                {
                        current_clock = m_current_timestamp;
                }

Index: server/asobj/NetStreamFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- server/asobj/NetStreamFfmpeg.h      12 May 2008 08:58:05 -0000      1.61
+++ server/asobj/NetStreamFfmpeg.h      12 May 2008 09:20:01 -0000      1.62
@@ -196,10 +196,13 @@
        // Misured in seconds.
        boost::uint32_t m_current_timestamp;
 
-       // The queues of audio and video data.
+       /// The queues of audio and video data.
        media::multithread_queue <media::raw_mediadata_t*> m_qaudio;
        media::multithread_queue <media::raw_mediadata_t*> m_qvideo;
 
+       /// Mutex protecting access to queues
+       boost::mutex _qMutex;
+
        // The time we started playing in seconds (since VM start ?)
        volatile boost::uint64_t m_start_clock;
 




reply via email to

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