void OnAboutToFinish(object o, Gst.GLib.SignalArgs args) { // HACK: ugly workaround for GStreamer's bug http://bugzilla.gnome.org/722769 // long story short, AboutToFinish signal firing twice for the same play of the same track // causes problems when Gapless Enabled because of RequestNextTrack event being fired twice if (about_to_finish_time_stamp == CurrentTrackTimeStamp) { return; } about_to_finish_time_stamp = CurrentTrackTimeStamp; // This is needed to make Shuffle-by-* work. // Shuffle-by-* uses the LastPlayed field to determine what track in the grouping to play next. // Therefore, we need to update this before requesting the next track. // // This will be overridden by IncrementLastPlayed () called by // PlaybackControllerService's EndOfStream handler. CurrentTrack.UpdateLastPlayed(); next_track_set.Reset(); OnEventChanged(PlayerEvent.RequestNextTrack); if (!next_track_set.WaitOne(1000, false)) { Log.Warning("[Gapless]: Timed out while waiting for next track to be set."); next_track_set.Set(); } }
void OnAboutToFinish(object o, Gst.GLib.SignalArgs args) { // This is needed to make Shuffle-by-* work. // Shuffle-by-* uses the LastPlayed field to determine what track in the grouping to play next. // Therefore, we need to update this before requesting the next track. // // This will be overridden by IncrementLastPlayed () called by // PlaybackControllerService's EndOfStream handler. CurrentTrack.UpdateLastPlayed(); next_track_set.Reset(); OnEventChanged(PlayerEvent.RequestNextTrack); if (!next_track_set.WaitOne(1000, false)) { Log.Warning("[Gapless]: Timed out while waiting for next track to be set."); next_track_set.Set(); } }