[Top][All Lists]
[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 11:54:38 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/05/12 11:54:37
Modified files:
. : ChangeLog
server/asobj : NetStreamFfmpeg.cpp NetStreamFfmpeg.h
Log message:
* 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
everytime a new frame is popped from the queue.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6590&r2=1.6591
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.122&r2=1.123
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.h?cvsroot=gnash&r1=1.63&r2=1.64
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6590
retrieving revision 1.6591
diff -u -b -r1.6590 -r1.6591
--- ChangeLog 12 May 2008 11:16:13 -0000 1.6590
+++ ChangeLog 12 May 2008 11:54:35 -0000 1.6591
@@ -1,5 +1,12 @@
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
+ everytime a new frame is popped from the queue.
+
+2008-05-12 Sandro Santilli <address@hidden>
+
* libmedia/ffmpeg/ffmpegNetStreamUtil.h: drop multithread_queue,
substitute with ElementsOwningQueue.
* server/asobj/NetStreamFfmpeg.{cpp,h}: use a simple
Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -b -r1.122 -r1.123
--- server/asobj/NetStreamFfmpeg.cpp 12 May 2008 11:16:15 -0000 1.122
+++ server/asobj/NetStreamFfmpeg.cpp 12 May 2008 11:54:37 -0000 1.123
@@ -129,6 +129,9 @@
// request decoder thread termination
m_go = false;
+ // resume the decoder, if waiting
+ _qFillerResume.notify_all();
+
// wait till thread is complete before main continues
_decodeThread->join();
@@ -164,9 +167,18 @@
}
{
+#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;
@@ -708,16 +720,9 @@
// If both queues are full then don't bother filling it
if ( ns->m_qvideo.full() && ns->m_qaudio.full() )
{
- // TODO: sleep till any of the two queues
- // falls under the given number
- // (20 currently, but should be a class
member really)
- //
- // NOTE: audio_streamer pops from m_qaudio and
- // refreshVideoFrame pops from m_qvideo,
wouldn't know
- // where to notify the condition from
(both?)
- //
- //log_debug("Queues full, sleeping more");
- sleepTime *= 4;
+ // Instead wait till waked up by short-queues
event
+ //log_debug("Queues full, waiting on
qNeedRefill condition");
+ ns->_qFillerResume.wait(lock);
}
else
{
@@ -784,7 +789,7 @@
return false;
}
- while (len > 0 && ns->m_qaudio.size() > 0)
+ while (ns->m_go && len > 0 && ! ns->m_qaudio.empty())
{
#ifdef GNASH_DEBUG_THREADS
log_debug("qMutex: waiting for lock in audio_streamer");
@@ -809,6 +814,9 @@
{
ns->m_qaudio.pop();
delete samples;
+
+ // wake up filler (TODO: do only if decoder is running)
+ ns->_qFillerResume.notify_all();
}
#ifdef GNASH_DEBUG_THREADS
@@ -1037,8 +1045,6 @@
media::raw_mediadata_t* video = new media::raw_mediadata_t();
- image::image_base* tmpImage = NULL;
-
if (m_videoFrameFormat == render::YUV)
{
video->m_data = new
boost::uint8_t[static_cast<image::yuv*>(m_imageframe)->size()];
@@ -1313,7 +1319,7 @@
}
// Loop until a good frame is found
- while(1)
+ while(!m_qvideo.empty())
{
// Get video frame from queue, will have the lowest timestamp
// will return NULL if empty(). See multithread_queue::front
@@ -1370,6 +1376,10 @@
m_qvideo.pop();
delete video;
+ // wake up filler (TODO: do only if decoder is running)
+ // TODO2: resume only at end of loop ?
+ _qFillerResume.notify_all();
+
// A frame is ready for pickup
m_newFrameReady = true;
@@ -1395,6 +1405,7 @@
void
NetStreamFfmpeg::advance()
{
+ //log_debug("advance");
// Make sure al decoding has stopped
// This can happen in 2 cases:
Index: server/asobj/NetStreamFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- server/asobj/NetStreamFfmpeg.h 12 May 2008 11:16:16 -0000 1.63
+++ server/asobj/NetStreamFfmpeg.h 12 May 2008 11:54:37 -0000 1.64
@@ -243,6 +243,9 @@
/// Mutex protecting access to queues
boost::mutex _qMutex;
+ /// Queues filler will wait on this condition when queues are full
+ boost::condition _qFillerResume;
+
// The time we started playing in seconds (since VM start ?)
volatile boost::uint64_t m_start_clock;