mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
CubebAudioStream: Fix crash in PulseAudio on Linux
This commit is contained in:
parent
d7f083559e
commit
86f0d32e70
|
@ -118,14 +118,7 @@ long CubebAudioStream::DataCallback(cubeb_stream* stm, void* user_ptr, const voi
|
|||
long nframes)
|
||||
{
|
||||
CubebAudioStream* const this_ptr = static_cast<CubebAudioStream*>(user_ptr);
|
||||
|
||||
if (this_ptr->m_output_volume_changed.load())
|
||||
{
|
||||
this_ptr->m_output_volume_changed.store(false);
|
||||
cubeb_stream_set_volume(this_ptr->m_cubeb_stream, static_cast<float>(this_ptr->m_output_volume) / 100.0f);
|
||||
}
|
||||
|
||||
this_ptr->ReadFrames(reinterpret_cast<SampleType*>(output_buffer), static_cast<u32>(nframes), false);
|
||||
this_ptr->ReadFrames(reinterpret_cast<SampleType*>(output_buffer), static_cast<u32>(nframes), true);
|
||||
return nframes;
|
||||
}
|
||||
|
||||
|
@ -149,12 +142,6 @@ void CubebAudioStream::DestroyContext()
|
|||
#endif
|
||||
}
|
||||
|
||||
void CubebAudioStream::SetOutputVolume(u32 volume)
|
||||
{
|
||||
AudioStream::SetOutputVolume(volume);
|
||||
m_output_volume_changed.store(true);
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioStream> AudioStream::CreateCubebAudioStream()
|
||||
{
|
||||
return std::make_unique<CubebAudioStream>();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
#include "common/audio_stream.h"
|
||||
#include "cubeb/cubeb.h"
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
|
||||
class CubebAudioStream final : public AudioStream
|
||||
|
@ -10,8 +9,6 @@ public:
|
|||
CubebAudioStream();
|
||||
~CubebAudioStream();
|
||||
|
||||
void SetOutputVolume(u32 volume) override;
|
||||
|
||||
protected:
|
||||
bool IsOpen() const { return m_cubeb_stream != nullptr; }
|
||||
|
||||
|
@ -29,7 +26,6 @@ protected:
|
|||
cubeb* m_cubeb_context = nullptr;
|
||||
cubeb_stream* m_cubeb_stream = nullptr;
|
||||
bool m_paused = true;
|
||||
std::atomic_bool m_output_volume_changed{ false };
|
||||
|
||||
#ifdef WIN32
|
||||
bool m_com_initialized_by_us = false;
|
||||
|
|
Loading…
Reference in a new issue