[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdemultimedia/phonon-xine
From:       Matthias Kretz <kretz () kde ! org>
Date:       2007-05-30 17:00:49
Message-ID: 1180544449.615224.10764.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 669868 by mkretz:

when xine asks for the preview but it's not there yet, block until it's ready or \
stopped

 M  +16 -0     bytestream.cpp  


--- trunk/KDE/kdemultimedia/phonon-xine/bytestream.cpp #669867:669868
@@ -136,9 +136,25 @@
     if (m_stopped) {
         return 0;
     }
+
     // never called from main thread
     //Q_ASSERT(m_mainThread != pthread_self());
 
+    if (m_preview.size() < MAX_PREVIEW_SIZE && !m_eod) {
+        QMutexLocker lock(&m_mutex);
+        // the thread needs to sleep until a wait condition is signalled from \
writeData +        while (!m_eod && !m_stopped && m_preview.size() < \
MAX_PREVIEW_SIZE) { +            PXINE_VDEBUG << k_funcinfo << "xine waits for data: \
" << m_buffersize << ", " << m_eod << endl; +            emit needDataQueued();
+            m_waitingForData.wait(&m_mutex);
+        }
+        if (m_stopped) {
+            PXINE_DEBUG << k_funcinfo << "returning 0, m_stopped = true" << endl;
+            //kDebug(610) << "UNLOCKING m_mutex: " << k_funcinfo << endl;
+            return 0;
+        }
+    }
+
     xine_fast_memcpy(buf, m_preview.constData(), m_preview.size());
     return m_preview.size();
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic