[Alsaplayer-devel] bug in save/restore of the pause functionality
Dominique Michel
dominique.michel at citycable.ch
Sat Mar 10 16:40:48 GMT 2007
Le Sat, 10 Mar 2007 17:53:18 +0100,
"Christoph Delfs" <christoph.delfs at gmx.de> a écrit :
> Hi again,
> of course, I tried now alsaplayer 0.99.77 to see whether the fix works. But
> I still face the same behaviour. The file (22 kHz [not 22,05 kHz -> wrong
> info below], 80 kbit/s) is played with half speed after pause/unpause. For
> security reasons I made the test in absence of my daughter.
Do you know where I can get such a file? You cannot send it by mail on the list
or private, but you can upload it on a host as http://rapidshare.de/
> I would like to point out that I do not change the speed (at least I do not
> issue any related command). But I still need to check whether alsaplayer has
> changed the speed (for some strange reason..) and need to make some update
> in my small application.
>
With the version on the svn and when paused, alsaplayer --pause must unpause
the daemon with the last used speed; alsaplayer --start must unpause with the
normal speed.
With 0.99.77, alsaplayer --pause do the same as alsaplayer --start, normal
speed again, but it can maybe be a difference when normal speed is not 100%
with status.
That for the daemon. The other interfaces can behave differently as the
daemon with pause and start when alsaplayer is paused.
Another solution will be to use "alsaplayer --speed <number>" to pause-unpause,
where number is a float number between -10 and 10. This must work with any
interface, and "--speed 1" must give normal speed again even when status give
something different as 100%
Can you install the svn version and test if it help. You will need automake (I
think in the autotools package) in order to run the bootstrap file. After this
step, it is the same as with the tarball.
> I use Debian 3.1 (Sarge) , removed all alsaplayer related packages (0.99.76
> of course) and installed directly alsaplayer-0.99.77. Alsaplayer is started
> just with:
> alsaplayer -s ALSA -i daemon --nosave --realtime& >/dev/null 2>/dev/null
> and as controlled via libalsaplayer and the application.
>
> BTW, I assume that even Debian 4.0 (Etch) will not contain alsaplayer
> 0.99.77 (feature freeze) and a bug report will not help :-) Anyway it will
> be up to the interested user to take care of latest SW.
>
0.99.77 is a bug fixes release and most of them are already in the 0.99.76
debian version.
Ciao,
Dominique
> Many thanks for your replies so far, Michel. I keep you updated on results
> of my next tests.
>
> Cheers
> Christoph
>
> -----Ursprüngliche Nachricht-----
> Von: alsaplayer-devel-bounces at lists.tartarus.org
> [mailto:alsaplayer-devel-bounces at lists.tartarus.org] Im Auftrag von
> Dominique Michel
> Gesendet: Mittwoch, 7. März 2007 15:23
> An: alsaplayer-devel at lists.tartarus.org
> Betreff: Re: [Alsaplayer-devel] bug in save/restore of the pause
> functionality
>
> Le Wed, 07 Mar 2007 18:40:25 +0100,
> "Christoph Delfs" <christoph.delfs at gmx.de> a écrit :
>
> > Hi all and Michel,
> > > It is hard to say because no one in the actual team was working on the
> > > alsaplayer before a few months ago.
> > fully understood and I am really (!!) happy that there is life again in
> the
> > alsaplayer scene :-) I still face the problem when using alsaplayer (.76
> > version) in daemon mode and issuing commands via alsaplayer's SW interface
> > whenever I use a 22,05 kHz file. With every pause/unpause the sound/voices
> > get more and more shifted to lower frequencies (as described by Eric). My
> > 8-year-old daughter is always frightenend whenever that happens... I could
> > give a try to check that on my own, but I am not sure if am qualified
> enough
> > to solve this. Cheers Christoph
> >
> As I said in my first mail, I didn't get this behaviour with the 0.99.77
> version (actually the same code as the svn in that regard). The code for the
> pause-unpause is changed as I wrote down-stair.
>
> It is changed in the code to always restart the pause at "normal" speed.
> That
> implies at, if you changed the speed before pausing, it will restart at
> normal
> speed, not at the speed you selected before pausing. But if you don't
> changed
> the speed before pausing, your daughter will not be frightened anymore.
>
> Another issue with 0.99.76 is at it is 2 very critical security issues with
> it. Their are solved in 0.99.77. If your distribution don't provide 0.99.77,
> please fill a bug report to your distribution.
>
> Cheers,
> Dominique
>
> >
> > -------- Original-Nachricht --------
> > Datum: Wed, 7 Mar 2007 14:07:56 +0100
> > Von: Dominique Michel <dominique.michel at citycable.ch>
> > An: alsaplayer-devel at lists.tartarus.org
> > CC:
> > Betreff: Re: [Alsaplayer-devel] bug in save/restore of the pause
> functionality
> >
> > > Le Wed, 07 Mar 2007 13:27:56 +0100,
> > > "Christoph Delfs" <christoph.delfs at gmx.de> a écrit :
> > >
> > > > Hi all,
> > >
> > > Hi Christof,
> > >
> > > > I am wondering whether the problem Eric Winn has described earlier (in
> > > 2005)
> > > > has been analyzed further in the past. I would like to cite from the
> > > mailing
> > > > list below. Any comments from the audience? Cheers Christoph
> > > >
> > > It is hard to say because no one in the actual team was working on the
> > > alsaplayer before a few months ago.
> > >
> > > But it seam at at least part of this problem have been fixed. I just try
> > > to
> > > reproduce this bug but was not able to do so. But I found something else
> > > that
> > > can be related.
> > >
> > > I was running alsaplayer with jack output at 48kHz and playing a mp3
> song
> > > at
> > > 44.1kHz. I get no problem with the pause-unpause, both in the GUI or
> with
> > > the
> > > command line.
> > >
> > > alsaplayer --status reported a speed of 91% all the time when playing.
> > >
> > > But, when increasing the speed by one comma, status reported a speed of
> > > 93%
> > > (0.91875*1.013643) before the pause-unpause, and 91% after the
> > > pause-unpause.
> > > 93% is correct, but 91% after the pause-unpause is not, especially with
> > > the GUI
> > > where it is another button to set the speed at normal playback speed.
> > >
> > > In fact, it is the same with the daemon, if a song is paused, alsaplayer
> > > --start will do the same as alsaplayer --pause.
> > >
> > > So, someone will have to lock into this. I suggest to keep the --start
> > > option and the 2 buttons (normal playback and reverse speed) in gtk GUI
> as
> > > they are, but to modify the pause behaviour so at it take in account not
> > > only
> > > the normal speed, but also the change of speed that an user can made
> > > before
> > > pausing. This value must be stored somewhere as alsaplayer --status is
> > > able to
> > > report it.
> > >
> > > Any volunteer?
> > >
> > > Ciao,
> > > Dominique
> > >
> > > > ######################################
> > > > Hi Erik,
> > > >
> > > > I will have a look at the problem. Sounds like a bug in the
> save/restore
> > > > of the pause functionality...
> > > >
> > > > Thanks,
> > > > Andy
> > > >
> > > > On Wed, Nov 05, 2003 at 11:18:27PM -0800, Erik Winn wrote:
> > > > > Hi,
> > > > >
> > > > > Tried a sort of brief question about this a few days ago - but it
> > > seems
> > > > > not to have even made it to the list; I would very much appreciate
> > > some
> > > > > sort of acknowledgement of this post if it is going to the private
> > > list (to
> > > > > which I have subscribed but also without response ...) so that I
> know
> > > if I
> > > > > am talking to the wall or not.
> > > > >
> > > > > For everything else, the latest version running with jackd 0.8 is
> > > great
> > > > > and quite impressive (I especially like the reverse playback feature
> -
> > > neat
> > > > > trick.), but I have found a nice glitch in pause/unpause
> funtionality
> > > that
> > > > > causes incremental decrease in playback sample rates.
> > > > >
> > > > > Here is the basic problem - I have isolated it to be related to the
> > > mad
> > > > > plugin's interaction with CorePlayer::GetSpeed/SetSpeed after Pause
> > > when
> > > > > the file being played is of a lower sample rate. For instance, I
> play
> > > an
> > > > > mp3 with 56 kbps, 22 kHz (joint stereo), no CRC, no padding. At
> 44100,
> > > > > ap_get_speed() returns 50 - which is correct scaling, but it seems
> > > that
> > > > > this is stored somewhere and used to SetSpeed after pause. Here is
> > > what I
> > > > > have found so far:
> > > > >
> > > > > First, it saves a pitch point in CorePlayer::Start like this
> > > > > CorePlayer.cpp, line 585:
> > > > > output_rate = node->SamplingRate();
> > > > > input_rate = plugin->sample_rate(the_object);
> > > > >
> > > > > if (input_rate == output_rate)
> > > > > SetSpeedMulti(1.0);
> > > > > else
> > > > > SetSpeedMulti((float) input_rate / (float)
> output_rate);
> > > > > update_pitch();
> > > > >
> > > > > ... well, mad_sample_rate will do this:
> > > > >
> > > > > mad_engine.c, line 745:
> > > > > if (data)
> > > > > return data->samplerate;
> > > > >
> > > > > ... which, at this point should be 22050. Meaning, we call,
> > > effectively,
> > > > > SetSpeedMulti(0.5), after which pitch_multi gets 0.5 - and then
> > > > > update_pitch essentially divides pitch in half:
> > > > >
> > > > > CorePlayer.cpp, line 953:
> > > > > pitch = pitch_point;
> > > > > }
> > > > > pitch *= pitch_multi;
> > > > >
> > > > > ... Now, the next call to GetSpeed will return 0.5, so if we now
> > > pause and
> > > > > unpause ... well, here it is:
> > > > >
> > > > > void CorePlayer::Pause()
> > > > > {
> > > > > save_speed = GetSpeed ();
> > > > > SetSpeed (0.0);
> > > > > }
> > > > >
> > > It is actually changed to
> > >
> > > void CorePlayer::Pause()
> > > {
> > > //save_speed = GetSpeed ();
> > > SetSpeed (0.0);
> > > }
> > >
> > > > >
> > > > > void CorePlayer::UnPause()
> > > > > {
> > > > > if (save_speed)
> > > > > SetSpeed (save_speed);
> > > > > else
> > > > > SetSpeed (1.0);
> > > > > }
> > > and
> > >
> > > void CorePlayer::UnPause()
> > > {
> > > //if (save_speed)
> > > // SetSpeed (save_speed);
> > > //else
> > > SetSpeed (1.0);
> > > }
> > >
> > > > >
> > > > > The result is that everytime one pauses/unpauses, the speed is cut
> in
> > > > > half. The same applies for 44100 samplerate mp3s if we are running
> > > jackd at
> > > > > 48000 and neglect to use -F 48000, frequency will be correctly
> scaled
> > > and
> > > > > ap_get_speed will return 92, so every un/pause will reduce playback
> by
> > > > > (previous_rate * 0.91875), and so on.
> > > > >
> > > > > I am quite unsure where to introduce a fix for this - I have only
> > > just
> > > > > started looking at the code and spent but a few hours with it. I
> would
> > > be
> > > > > happy to implement it and submit a patch if you would be good enough
> > > to
> > > > > suggest where/how this might be done to fit and not break frequency
> > > scaling.
> > > > >
> > > > > Best, and thanks for a nice player,
> > > > > Erik Winn
> > > > #######################################
> > > >
> > >
> > >
> > > --
> > > Dominique Michel
> > >
> > > --
> > > N.B.: Tous les emails que je reçois sont filtrés par spamassassin avant
> > > de me
> > > parvenir.
> > >
> > > _______________________________________________
> > > alsaplayer-devel mailing list
> > > alsaplayer-devel at lists.tartarus.org
> > > http://lists.tartarus.org/mailman/listinfo/alsaplayer-devel
> >
>
>
--
Dominique Michel
--
N.B.: Tous les emails que je reçois sont filtrés par spamassassin avant de me
parvenir.
More information about the alsaplayer-devel
mailing list