File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ FilteredAudioOutput::Cancel() noexcept
192192void
193193FilteredAudioOutput::BeginPause () noexcept
194194{
195- if (!output->SupportsPauseWithoutCancel ())
195+ if (!output->SupportsHardwarePause ())
196196 Cancel ();
197197}
198198
Original file line number Diff line number Diff line change @@ -40,14 +40,24 @@ public:
4040 return flags & FLAG_PAUSE ;
4141 }
4242
43- virtual bool SupportsPauseWithoutCancel () const noexcept {
44- return false ;
45- }
46-
4743 bool GetNeedFullyDefinedAudioFormat () const noexcept {
4844 return flags & FLAG_NEED_FULLY_DEFINED_AUDIO_FORMAT ;
4945 }
5046
47+ /* *
48+ * Returns true if this plugin can pause playback without first
49+ * discarding buffered audio via Cancel(). When this returns true,
50+ * #FilteredAudioOutput::BeginPause() will skip the Cancel() call,
51+ * allowing the plugin to preserve its hardware buffer across a pause
52+ * and resume it intact when Play() is next called.
53+ *
54+ * Plugins that return true must handle buffer cleanup if
55+ * Cancel() is called while paused (e.g. on stop or seek).
56+ */
57+ virtual bool SupportsHardwarePause () const noexcept {
58+ return false ;
59+ }
60+
5161 /* *
5262 * Returns a map of runtime attributes.
5363 *
Original file line number Diff line number Diff line change @@ -400,7 +400,7 @@ class AlsaOutput final
400400 Event::Duration PrepareSockets () noexcept override ;
401401 void DispatchSockets () noexcept override ;
402402
403- bool SupportsPauseWithoutCancel () const noexcept override {
403+ bool SupportsHardwarePause () const noexcept override {
404404 return !close_on_pause && hw_can_pause;
405405 }
406406
@@ -1103,7 +1103,6 @@ AlsaOutput::CancelInternal() noexcept
11031103 ring_buffer.Clear ();
11041104
11051105 active = false ;
1106- paused = false ;
11071106 waiting = false ;
11081107
11091108 UnregisterSockets ();
You can’t perform that action at this time.
0 commit comments