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

List:       kde-multimedia
Subject:    Re: Patch for Kaiman
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2000-08-25 12:37:04
[Download RAW message or body]

Hi!

On Thu, Aug 24, 2000 at 06:34:34PM +0200, Antonio Larrosa wrote:
> I've noticed that aRts crashes some times when playing "corrupted"(?)
> files and this makes Kaiman crash too.
> 
> The attached patch makes Kaiman "feel" more stable, as it detects when
> aRts has crashed, try to run it again and re-connect to it. Also, if
> aRts is not running when starting Kaiman, it starts it instead of
> asking the user to do it by himself.

Yes, I think this is a good idea (though of course debugging all
artsd crashes is also a good idea ;).

> To try it, just killall artsd, run Kaiman, play a file, while it's
> being played killall artsd, and click on play again, then killall artsd,
> and click on quit. You can try those three tests with and without the
> patch to see the difference.
> 
> There are three things in this patch that I'm not sure to be the best
> solutions. First, I used sometimes soundServer = Arts::Reference(....);
> If the name is right and it's a reference, there's no problem with
> getting it many times, but if that function returns a new copy, then
> the patch is wrong because it will leak memory.

It is a reference, so no problem here.

> The second problem is that I cannot use -d when running aRts from Kaiman
> (although it works when running aRts from a Konsole).

I can't reproduce this here. It works fine when kaiman starts artsd as well.
I uncommented the commented-out full duplex lines, and tested it with
artsbuilder, some full duplex test struct and a microphone, and the only
thing you need to do when you killall artsd (which kaiman promptly restarts)
is restarting the execution in artsbuilder as well.

I noticed some "timeout occured" messages, but they are present in either
way of starting artsd and obviously no problem, they are probably occuring
now because we changed the packet size in "confortable" mode recently.

> The third problem is that there's a race condition when starting aRts.
> Anyway, I'm not very worried about this, as in the worst case of the
> race condition we get the current behaviour and in the best case, we
> get a much better behaviour.

This can be fixed easily by adding a retry cycle to after the "system"
command which could look like the one in knotify (see kdelibs/arts/knotify).

There are three more issues I observed:

 * code duplication

Currently, you have code from kcmarts, which means that once you change
kcmarts, you also need to change kaiman, which is not exactly maintainable,
especially if more apps start using a technique like this.

 * starting on the wrong computer

If you are running artsd network transparent, then eventually the restart
will happen on the wrong machine. Which can't be exactly solved for KDE2.0
I guess, and is not so bad, because you'll run into trouble with a network
transparent kaiman anyway.

 * better use .error() to detect errors

To see if the MCOP invocation

  foo.doSomething();

went all-right (or didn't work, since the server holding the foo-Object has
crashed) is checking foo.error() afterwards. I attached a patch against your
patch to show how it should be done in the .play() method.

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         

["kaiman.diff2" (text/plain)]

--- kaiman.cpp.antonio	Fri Aug 25 13:09:24 2000
+++ kaiman.cpp	Fri Aug 25 13:16:26 2000
@@ -344,23 +344,17 @@
     kdDebug() << " Kaiman::play " << file << endl;
     _playObject = _playObjectFactory.createPlayObject( file.ascii() );
 
-    if ( _playObject.isNull() ) {
-
-       // Let's check if the connection with arts was broken
-       _playObjectFactory = Arts::Reference("global:Arts_PlayObjectFactory");
-
-       if(!_playObjectFactory.isNull()) return false;
-
-       // It was broken, so let's try to reestablish it again
+    if ( _playObjectFactory.error() ) {
+       // If connection to artsd was broken, try to reestablish it again
 
        if (!initArts()) return false;
 
        // Cool, we were able to connect.
 
        _playObject = _playObjectFactory.createPlayObject( file.ascii() );
-
-       if ( _playObject.isNull() ) return false;
     }
+
+    if ( _playObject.isNull() ) return false;
 
     _playObject.play();
     return _playObject.state()==Arts::posPlaying;

_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia


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

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