gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9942: Stop using _stream inside get


From: Bastiaan Jacques
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9942: Stop using _stream inside getBytesLoaded. (fixes #24460)
Date: Mon, 06 Oct 2008 19:52:45 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9942
committer: Bastiaan Jacques <address@hidden>
branch nick: trunk
timestamp: Mon 2008-10-06 19:52:45 +0200
message:
  Stop using _stream inside getBytesLoaded. (fixes #24460)
  AudioDecoderGst: use ffaudioresample, or fallback on speexresample; if
    neither are available, use audioresample. ("fixes" #24417)
modified:
  libmedia/gst/AudioDecoderGst.cpp
  libmedia/gst/MediaParserGst.cpp
    ------------------------------------------------------------
    revno: 9922.1.4
    committer: Bastiaan Jacques <address@hidden>
    branch nick: gst-release
    timestamp: Mon 2008-10-06 17:23:46 +0200
    message:
      Test the effect of using ffaudioresample.
    modified:
      libmedia/gst/AudioDecoderGst.cpp
    ------------------------------------------------------------
    revno: 9922.1.5
    committer: Bastiaan Jacques <address@hidden>
    branch nick: gst-release
    timestamp: Mon 2008-10-06 17:48:22 +0200
    message:
      Use _bytesLoaded and its mutex to promote thread safety.
    modified:
      libmedia/gst/MediaParserGst.cpp
    ------------------------------------------------------------
    revno: 9922.1.6
    committer: Bastiaan Jacques <address@hidden>
    branch nick: gst-release
    timestamp: Mon 2008-10-06 17:51:41 +0200
    message:
      Read, don't set.
    modified:
      libmedia/gst/MediaParserGst.cpp
    ------------------------------------------------------------
    revno: 9922.1.7
    committer: Bastiaan Jacques <address@hidden>
    branch nick: gst-release
    timestamp: Mon 2008-10-06 18:18:37 +0200
    message:
      Try to use all alternative audio resamplers and warn if we only have the 
base.
    modified:
      libmedia/gst/AudioDecoderGst.cpp
=== modified file 'libmedia/gst/AudioDecoderGst.cpp'
--- a/libmedia/gst/AudioDecoderGst.cpp  2008-10-06 08:26:32 +0000
+++ b/libmedia/gst/AudioDecoderGst.cpp  2008-10-06 16:18:37 +0000
@@ -94,6 +94,31 @@
     swfdec_gst_decoder_finish(&_decoder);
 }
 
+std::string 
+findResampler()
+{
+    std::string resampler = "ffaudioresample";
+
+    GstElementFactory* factory = gst_element_factory_find(resampler.c_str());
+     
+    if (!factory) {
+        resampler = "speexresample";
+        factory = gst_element_factory_find(resampler.c_str());
+        if (!factory) {
+            log_error(_("The best available resampler is 'audioresample'."
+                      " Please install gstreamer-ffmpeg 0.10.4 or newer, or 
you"
+                      " may experience long delays in audio playback!"));
+            resampler = "audioresample";
+        }
+    }
+
+    if (factory) {
+        gst_object_unref(factory);
+    }
+
+    return resampler;
+}
+
 
 
 void AudioDecoderGst::setup(GstCaps* srccaps)
@@ -107,10 +132,9 @@
         throw MediaException(_("AudioDecoderGst: internal error (caps creation 
failed)"));      
     }
 
-    // TODO: we may want to prefer other modules over audioresample, like 
ffaudioresample, if they are
-    // available.
+    std::string resampler = findResampler();
 
-    bool rv = swfdec_gst_decoder_init (&_decoder, srccaps, sinkcaps, 
"audioconvert", "audioresample", NULL);
+    bool rv = swfdec_gst_decoder_init (&_decoder, srccaps, sinkcaps, 
"audioconvert", resampler.c_str(), NULL);
     if (!rv) {
         throw MediaException(_("AudioDecoderGst: initialisation failed."));    
  
     }

=== modified file 'libmedia/gst/MediaParserGst.cpp'
--- a/libmedia/gst/MediaParserGst.cpp   2008-10-06 09:59:04 +0000
+++ b/libmedia/gst/MediaParserGst.cpp   2008-10-06 15:51:41 +0000
@@ -149,6 +149,11 @@
 
     pushGstBuffer();
 
+    {
+        boost::mutex::scoped_lock lock(_bytesLoadedMutex);
+        _bytesLoaded = _stream->tell();
+    }
+
     emitEncodedFrames();
 
     return true;
@@ -158,9 +163,8 @@
 boost::uint64_t
 MediaParserGst::getBytesLoaded() const
 {
-    boost::mutex::scoped_lock streamLock(_streamMutex);
-
-    return _stream->tell();
+    boost::mutex::scoped_lock lock(_bytesLoadedMutex);
+    return _bytesLoaded;
 }
 
 bool


reply via email to

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