[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-117-g414f77a |
Date: |
Wed, 23 Feb 2011 08:26:25 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via 414f77a41775378903e24603aa97f0228036fa18 (commit)
from 97ce2c57bf3c33d9cf9bde37ed7e5ffc49c48177 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=414f77a41775378903e24603aa97f0228036fa18
commit 414f77a41775378903e24603aa97f0228036fa18
Author: Sandro Santilli <address@hidden>
Date: Wed Feb 23 09:24:54 2011 +0100
Make peek functions private and non-locking. Have NextTimestamp fetcher
lock instead, to ensure the fetched frame is not deleted by another thread
before having a chance to query its timestamp. Fixes bug #32540. Thanks
Bastiaan Jacques for doing the hard work of figuring out the problem.
diff --git a/libmedia/MediaParser.cpp b/libmedia/MediaParser.cpp
index 74bbd9a..0068963 100644
--- a/libmedia/MediaParser.cpp
+++ b/libmedia/MediaParser.cpp
@@ -107,11 +107,12 @@ MediaParser::audioBufferLength() const
return _audioFrames.back()->timestamp -
_audioFrames.front()->timestamp;
}
+/*private*/
const EncodedVideoFrame*
MediaParser::peekNextVideoFrame() const
{
#ifdef LOAD_MEDIA_IN_A_SEPARATE_THREAD
- boost::mutex::scoped_lock lock(_qMutex);
+ // TODO: assert _qMutex is locked by this thread
#else // ndef LOAD_MEDIA_IN_A_SEPARATE_THREAD
while (!parsingCompleted() && _videoInfo.get() && _videoFrames.empty())
{
@@ -166,6 +167,9 @@ MediaParser::nextFrameTimestamp(boost::uint64_t& ts) const
bool
MediaParser::nextVideoFrameTimestamp(boost::uint64_t& ts) const
{
+#ifdef LOAD_MEDIA_IN_A_SEPARATE_THREAD
+ boost::mutex::scoped_lock lock(_qMutex);
+#endif // def LOAD_MEDIA_IN_A_SEPARATE_THREAD
const EncodedVideoFrame* ef = peekNextVideoFrame();
if ( ! ef ) return false;
ts = ef->timestamp();
@@ -221,17 +225,21 @@ MediaParser::nextAudioFrame()
bool
MediaParser::nextAudioFrameTimestamp(boost::uint64_t& ts) const
{
+#ifdef LOAD_MEDIA_IN_A_SEPARATE_THREAD
+ boost::mutex::scoped_lock lock(_qMutex);
+#endif // def LOAD_MEDIA_IN_A_SEPARATE_THREAD
const EncodedAudioFrame* ef = peekNextAudioFrame();
if ( ! ef ) return false;
ts = ef->timestamp;
return true;
}
+/*private*/
const EncodedAudioFrame*
MediaParser::peekNextAudioFrame() const
{
#ifdef LOAD_MEDIA_IN_A_SEPARATE_THREAD
- boost::mutex::scoped_lock lock(_qMutex);
+ // TODO: assert _qMutex is locked by this thread
#else // ndef LOAD_MEDIA_IN_A_SEPARATE_THREAD
while (!parsingCompleted() && _audioInfo.get() && _audioFrames.empty())
{
diff --git a/libmedia/MediaParser.h b/libmedia/MediaParser.h
index d9dd995..a4cb2c1 100644
--- a/libmedia/MediaParser.h
+++ b/libmedia/MediaParser.h
@@ -494,6 +494,8 @@ public:
/// @param ts will be set to timestamp of next available frame
/// @return false if no frame is available yet
///
+ /// NOTE: locks _qMutex
+ ///
DSOEXPORT bool nextFrameTimestamp(boost::uint64_t& ts) const;
/// Get timestamp of the video frame which would be returned on
nextVideoFrame
@@ -501,6 +503,8 @@ public:
/// @return false if there no video frame left
/// (either none or no more)
///
+ /// NOTE: locks _qMutex
+ ///
DSOEXPORT bool nextVideoFrameTimestamp(boost::uint64_t& ts) const;
/// Returns the next video frame in the parsed buffer, advancing video
cursor.
@@ -517,6 +521,8 @@ public:
/// @return false if there no video frame left
/// (either none or no more)
///
+ /// NOTE: locks _qMutex
+ ///
DSOEXPORT bool nextAudioFrameTimestamp(boost::uint64_t& ts) const;
/// Returns the next audio frame in the parsed buffer, advancing audio
cursor.
@@ -637,18 +643,6 @@ protected:
///
void pushEncodedVideoFrame(std::auto_ptr<EncodedVideoFrame> frame);
- /// Return pointer to next encoded video frame in buffer
- //
- /// If no video is present, or queue is empty, 0 is returned
- ///
- const EncodedVideoFrame* peekNextVideoFrame() const;
-
- /// Return pointer to next encoded audio frame in buffer
- //
- /// If no video is present, or queue is empty, 0 is returned
- ///
- const EncodedAudioFrame* peekNextAudioFrame() const;
-
/// The stream used to access the file
std::auto_ptr<IOChannel> _stream;
mutable boost::mutex _streamMutex;
@@ -712,11 +706,29 @@ protected:
/// The parser, when obtained a lock on _streamMutex, will check this
/// flag, if found to be true will clear the buffers and reset to false.
bool _seekRequest;
+
private:
typedef std::deque<EncodedVideoFrame*> VideoFrames;
typedef std::deque<EncodedAudioFrame*> AudioFrames;
+ /// Return pointer to next encoded video frame in buffer
+ //
+ /// If no video is present, or queue is empty, 0 is returned
+ ///
+ /// NOTE: Caller is expected to hold a lock on _qMutex
+ ///
+ const EncodedVideoFrame* peekNextVideoFrame() const;
+
+ /// Return pointer to next encoded audio frame in buffer
+ //
+ /// If no video is present, or queue is empty, 0 is returned
+ ///
+ /// NOTE: Caller is expected to hold a lock on _qMutex
+ ///
+ const EncodedAudioFrame* peekNextAudioFrame() const;
+
+
/// Queue of video frames (the video buffer)
//
/// Elements owned by this class.
-----------------------------------------------------------------------
Summary of changes:
libmedia/MediaParser.cpp | 12 ++++++++++--
libmedia/MediaParser.h | 36 ++++++++++++++++++++++++------------
2 files changed, 34 insertions(+), 14 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-117-g414f77a,
Sandro Santilli <=