MusicPipe: automatically clear in destructor
We can implement this now that we have a MusicBuffer reference.
This commit is contained in:
parent
9f14e7a98d
commit
e81b089612
@ -67,12 +67,8 @@ public:
|
|||||||
|
|
||||||
MusicPipe(const MusicPipe &) = delete;
|
MusicPipe(const MusicPipe &) = delete;
|
||||||
|
|
||||||
/**
|
~MusicPipe() noexcept {
|
||||||
* Frees the object. It must be empty now.
|
Clear();
|
||||||
*/
|
|
||||||
~MusicPipe() {
|
|
||||||
assert(head == nullptr);
|
|
||||||
assert(tail_r == &head);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicPipe &operator=(const MusicPipe &) = delete;
|
MusicPipe &operator=(const MusicPipe &) = delete;
|
||||||
|
@ -407,11 +407,8 @@ MultipleOutputs::Close() noexcept
|
|||||||
for (auto *ao : outputs)
|
for (auto *ao : outputs)
|
||||||
ao->LockCloseWait();
|
ao->LockCloseWait();
|
||||||
|
|
||||||
if (pipe != nullptr) {
|
delete pipe;
|
||||||
pipe->Clear();
|
pipe = nullptr;
|
||||||
delete pipe;
|
|
||||||
pipe = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
input_audio_format.Clear();
|
input_audio_format.Clear();
|
||||||
|
|
||||||
@ -424,11 +421,8 @@ MultipleOutputs::Release() noexcept
|
|||||||
for (auto *ao : outputs)
|
for (auto *ao : outputs)
|
||||||
ao->LockRelease();
|
ao->LockRelease();
|
||||||
|
|
||||||
if (pipe != nullptr) {
|
delete pipe;
|
||||||
pipe->Clear();
|
pipe = nullptr;
|
||||||
delete pipe;
|
|
||||||
pipe = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
input_audio_format.Clear();
|
input_audio_format.Clear();
|
||||||
|
|
||||||
|
@ -169,14 +169,9 @@ private:
|
|||||||
xfade_state = CrossFadeState::UNKNOWN;
|
xfade_state = CrossFadeState::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearAndDeletePipe() noexcept {
|
|
||||||
pipe->Clear();
|
|
||||||
delete pipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearAndReplacePipe(MusicPipe *_pipe) noexcept {
|
void ClearAndReplacePipe(MusicPipe *_pipe) noexcept {
|
||||||
ResetCrossFade();
|
ResetCrossFade();
|
||||||
ClearAndDeletePipe();
|
delete pipe;
|
||||||
pipe = _pipe;
|
pipe = _pipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,7 +1065,7 @@ Player::Run() noexcept
|
|||||||
CancelPendingSeek();
|
CancelPendingSeek();
|
||||||
StopDecoder();
|
StopDecoder();
|
||||||
|
|
||||||
ClearAndDeletePipe();
|
delete pipe;
|
||||||
|
|
||||||
cross_fade_tag.reset();
|
cross_fade_tag.reset();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user