private void OnAboutToFinish(IntPtr player) { // 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(); pending_uri = null; next_track_pending = true; OnEventChanged(PlayerEvent.RequestNextTrack); // Gapless playback with Playbin2 requires that the about-to-finish callback does not return until // the next uri has been set. Block here for a second or until the RequestNextTrack event has // finished triggering. if (!next_track_set.WaitOne(1000, false)) { Log.Debug("[Gapless] Timed out while waiting for next_track_set to be raised"); next_track_set.Set(); } }
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(); } }
private void OnAboutToFinish(IntPtr player) { // 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(); pending_uri = null; next_track_pending = true; OnEventChanged(PlayerEvent.RequestNextTrack); // Gapless playback with Playbin2 requires that the about-to-finish callback does not return until // the next uri has been set. Block here for a second or until the RequestNextTrack event has // finished triggering. if (!next_track_set.WaitOne(1000, false)) { Log.Debug("[Gapless] Timed out while waiting for next_track_set to be raised"); next_track_set.Set(); } }