[haiku-commits] Re: r36392 - haiku/trunk/src/apps/mediaplayer

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 22 Apr 2010 17:53:37 +0200

Hi,

"Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx> wrote:
> Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> > On 2010-04-22 at 14:17:29 [+0200], Axel Dörfler
> <axeld@xxxxxxxxxxxxxxxx> 
> > > wrote:
> > > Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> > > > > -    fController->TogglePlaying();
> > > > > +    BAutolock _(fPlaylist);
> > > > > +    if (fPlaylist->CurrentItemIndex() < 0) {
> > > > > +        // No valid playlist item - start again from the first 
> > > > > one
> > > > > +        fPlaylist->SetCurrentItemIndex(0);
> > > > > +    } else
> > > > > +        fController->TogglePlaying();
> > > > >  }
> > > > I don't quite see why this would start playing, if paused before.
> > > If it was actually paused there is a valid playlist item, ie. the
> > > current item index is >= 0.
> > But then I don't see why this change would fix the ticket. The >= 0 
> > case is 
> > unchanged and the other case (if there is a play list item at all) 
> > wouldn't 
> > start playing anymore. I just tested r36408 and can confirm that the 
> > behavior is still (or maybe differently?) broken. Hitting "play" 
> > after the 
> > song played to its end starts playing the song, but the seek marker 
> > is 
> > stuck at the end.
> 
> The seek marker worked just fine with the file I tested with, and I 
> didn't look into that particular issue, as I couldn't reproduce it 
> anyway.
> What I fixed with this change is that the song/video will play twice 
> after the first time.
> 
> What happened is that the MediaPlayer sets the current playlist item to 
> -1 after the last file, and always sets it to "current + 1" after a 
> file has finished.
> Since only the controller was aware of the replay, the playlist item 
> would still be -1 during the first replay, then when the song was over, 
> the next item in the playlist was chosen, -1 + 1 == 0, so the first 
> song was played again.
> 
> > I'm not familiar with the code, so I don't really know what should be 
> > done 
> > here. Maybe Stippi can comment.
> 
> +alphabranch :-)

I've been testing the change and couldn't reproduce the issues that Ingo saw. 
However, I've commited an improved version of the fix. Mainly it prevents the 
navigation buttons indicating confusing capabilities. The playlist item will 
remain on the last item now and ControllerView checks the position in order to 
know when to skip to the first playlist item.

Best regards,
-Stephan

Other related posts: