Skip to content

Commit b7f4893

Browse files
committed
review comments
1 parent ccce638 commit b7f4893

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/output/Filtered.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ FilteredAudioOutput::Cancel() noexcept
192192
void
193193
FilteredAudioOutput::BeginPause() noexcept
194194
{
195-
if (!output->SupportsPauseWithoutCancel())
195+
if (!output->SupportsHardwarePause())
196196
Cancel();
197197
}
198198

src/output/Interface.hxx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff 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
*

src/output/plugins/AlsaOutputPlugin.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)