gnash-dev
[Top][All Lists]
Advanced

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

Re: [Gnash-dev] Re: Burning 100% CPU time: MediaParser/FLVParser never p


From: John Gilmore
Subject: Re: [Gnash-dev] Re: Burning 100% CPU time: MediaParser/FLVParser never pauses
Date: Mon, 09 Aug 2010 01:30:53 -0700

> > But even if I was able to pick the ffmpeg media handler from the
> > command line, how would I pick it from the plugin?  There's nothing
> > in the Preferences menu to set it.  Is there some secret .gnashrc
> > setting somewhere?  If so, can someone document it in the release?
> 
>   I think that this was left out when the change to support two media
> handlers was made recently. This would be easy to add, just clone what I
> added for the HWAccel option.

It was easy to find where to clone it in the rc-file reading and
writing code, but after a lot of prowling around I am not clear
on where to actually have the setting take effect.

In gprocessor I think I found it here:

=== modified file 'utilities/processor.cpp'
--- utilities/processor.cpp     2010-07-14 13:43:06 +0000
+++ utilities/processor.cpp     2010-08-09 07:40:47 +0000
@@ -353,7 +353,8 @@
     boost::shared_ptr<gnash::media::MediaHandler> mediaHandler;
     boost::shared_ptr<sound::sound_handler> soundHandler;
 
-    mediaHandler.reset(media::MediaFactory::instance().get(""));
+    std::string mh = rcfile.getMediaHandler();
+    mediaHandler.reset(media::MediaFactory::instance().get(mh));
     soundHandler.reset(new sound::NullSoundHandler(mediaHandler.get()));
 
     boost::shared_ptr<StreamProvider> sp(new StreamProvider);

but in the main player all I found was a big tangle -- there's the
rcfile media handler, the command line option parser, the Player media
handler, and the actual MediaFactory call (which occurs from
gnash-view.cpp, gnash.cpp, Player.cpp, processor.cpp, and
MovieTester.cpp).  It's not clear where the default should be moved
from the rc file into the factory, nor how the error should be
reported if it's set to an unsupported value.  I would've stuck it
into the Player class, since that's common to all, but for the comment
"TODO: we should remove all uses of the rcfile from Player class."
Somebody who loves this code should lovingly insert whatever multiple
two-line changes they think are best.

I've appended the patches for the part I got done.

It appears that it's using ffmpeg as the media handler all the time,
since I configured it with both gst and ffmpeg, and ffmpeg is the
first one in the table.  So I guess ffmpeg works with my change to
make the media parser sleep when not busy.  I've included that patch
below, too.

        John

=== modified file 'libbase/rc.cpp'
--- libbase/rc.cpp      2010-07-06 10:59:44 +0000
+++ libbase/rc.cpp      2010-08-09 07:11:05 +0000
@@ -500,6 +500,11 @@
                 continue;
             }
             
+            if(noCaseCompare(variable, "MediaHandler")) {
+                _mediahandler = value;
+                continue;
+            }
+            
             if (noCaseCompare(variable, "CertDir") ) {
                 expandPath(value);
                 _certdir = value;

=== modified file 'libbase/rc.h'
--- libbase/rc.h        2010-05-04 20:58:55 +0000
+++ libbase/rc.h        2010-08-09 08:12:01 +0000
@@ -1,3 +1,4 @@
+// rc.h:  "Run Command" configuration file declarations, for Gnash.
 // 
 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
 //   Foundation, Inc
@@ -246,12 +247,18 @@
     // Set the name of the hardware acclerator to use for video
     void setHWAccel(const std::string &x) { _hwaccel = x; }
 
-    // Get the name of the hardware acclerator to use for video
+    // Get the name of the renderer to draw the display
     const std::string& getRenderer() const { return _renderer; }
 
-    // Set the name of the hardware acclerator to use for video
+    // Set the name of the renderer to draw the display
     void setRenderer(const std::string& x) { _renderer = x; }
 
+    // Get the name of the media handler to use for video/audio
+    const std::string& getMediaHandler() const { return _mediahandler; }
+
+    // Set the name of the media handler to use for video/audio
+    void setMediaHandler(const std::string& x) { _mediahandler = x; }
+
     // Get the location of the sandbox for .sol files
     const std::string &getSOLSafeDir() const { return _solsandbox; }
 
@@ -580,15 +587,19 @@
     /// default value is true
     bool _ignoreShowMenu;
 
-    /// Whether to ue HW video decoding support, no value means disabled.
-    /// The only currently supported values are: none, vaapi,  or xv (omap)
-    /// support coming. 
+    /// Whether to use HW video decoding support, no value means disabled.
+    /// The only currently supported values are: none, vaapi, or xv.  omap
+    /// support is coming. 
     std::string _hwaccel;
 
     /// Which renderer backend to use, no value means use the default.
     /// The currently supported values are agg, opengl, or cairo. AGG
     /// being the default.
     std::string _renderer;
+
+    /// Which media player backend to use, no value means use the default.
+    /// The default is set in the MediaFactory initialization table.
+    std::string _mediahandler;
 };
 
 // End of gnash namespace 

=== modified file 'libmedia/MediaHandler.h'
--- libmedia/MediaHandler.h     2010-07-20 06:51:24 +0000
+++ libmedia/MediaHandler.h     2010-08-09 07:33:52 +0000
@@ -90,7 +90,7 @@
     /// Create a VideoDecoder for decoding what's specified in the VideoInfo
     //
     /// @param info VideoInfo class with all the info needed to decode
-    ///             the sound correctly.
+    ///             the image stream correctly.
     /// @return     Will always return a valid VideoDecoder or throw a
     ///             gnash::MediaException if a fatal error occurs.
     virtual std::auto_ptr<VideoDecoder>

=== modified file 'libmedia/MediaParser.cpp'
--- libmedia/MediaParser.cpp    2010-01-01 17:48:26 +0000
+++ libmedia/MediaParser.cpp    2010-08-06 02:47:13 +0000
@@ -411,7 +411,10 @@
        while (!parserThreadKillRequested())
        {
                parseNextChunk();
-               gnashSleep(100); // no rush....
+               {
+                       boost::mutex::scoped_lock lock(_qMutex);
+                       waitIfNeeded(lock);
+               }
        }
 }
 

=== modified file 'utilities/processor.cpp'
--- utilities/processor.cpp     2010-07-14 13:43:06 +0000
+++ utilities/processor.cpp     2010-08-09 07:40:47 +0000
@@ -353,7 +353,8 @@
     boost::shared_ptr<gnash::media::MediaHandler> mediaHandler;
     boost::shared_ptr<sound::sound_handler> soundHandler;
 
-    mediaHandler.reset(media::MediaFactory::instance().get(""));
+    std::string mh = rcfile.getMediaHandler();
+    mediaHandler.reset(media::MediaFactory::instance().get(mh));
     soundHandler.reset(new sound::NullSoundHandler(mediaHandler.get()));
 
     boost::shared_ptr<StreamProvider> sp(new StreamProvider);




reply via email to

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