Disable workaround on Windows

This is reported to cause more issues than solve there. Disable since people keep complaining.
This commit is contained in:
v1993
2022-05-01 21:02:07 +03:00
parent e919bea9c8
commit 828c830400
2 changed files with 13 additions and 7 deletions

View File

@@ -87,6 +87,7 @@ static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) {
} }
void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) { void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) {
#ifndef _WIN32
auto now = std::chrono::steady_clock::now(); auto now = std::chrono::steady_clock::now();
auto duration = now.time_since_epoch(); auto duration = now.time_since_epoch();
auto nanoseconds = std::chrono::duration_cast<std::chrono::nanoseconds>(duration); auto nanoseconds = std::chrono::duration_cast<std::chrono::nanoseconds>(duration);
@@ -94,6 +95,7 @@ void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) {
if (nanoseconds > expected_cb_time) { if (nanoseconds > expected_cb_time) {
ns_late = nanoseconds - expected_cb_time; ns_late = nanoseconds - expected_cb_time;
} }
#endif
if (!IsPlaying()) { if (!IsPlaying()) {
// Ensure we are in playing state before playing the next buffer // Ensure we are in playing state before playing the next buffer
@@ -129,7 +131,9 @@ void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) {
ns_late = {}; ns_late = {};
} }
#ifndef _WIN32
expected_cb_time = nanoseconds + (buffer_release_ns - ns_late); expected_cb_time = nanoseconds + (buffer_release_ns - ns_late);
#endif
core_timing.ScheduleEvent(buffer_release_ns - ns_late, release_event, {}); core_timing.ScheduleEvent(buffer_release_ns - ns_late, release_event, {});
} }

View File

@@ -117,14 +117,16 @@ private:
ReleaseCallback release_callback; ///< Buffer release callback for the stream ReleaseCallback release_callback; ///< Buffer release callback for the stream
State state{State::Stopped}; ///< Playback state of the stream State state{State::Stopped}; ///< Playback state of the stream
std::shared_ptr<Core::Timing::EventType> std::shared_ptr<Core::Timing::EventType>
release_event; ///< Core timing release event for the stream release_event; ///< Core timing release event for the stream
BufferPtr active_buffer; ///< Actively playing buffer in the stream BufferPtr active_buffer; ///< Actively playing buffer in the stream
std::queue<BufferPtr> queued_buffers; ///< Buffers queued to be played in the stream std::queue<BufferPtr> queued_buffers; ///< Buffers queued to be played in the stream
std::queue<BufferPtr> released_buffers; ///< Buffers recently released from the stream std::queue<BufferPtr> released_buffers; ///< Buffers recently released from the stream
SinkStream& sink_stream; ///< Output sink for the stream SinkStream& sink_stream; ///< Output sink for the stream
Core::Timing::CoreTiming& core_timing; ///< Core timing instance. Core::Timing::CoreTiming& core_timing; ///< Core timing instance.
std::string name; ///< Name of the stream, must be unique std::string name; ///< Name of the stream, must be unique
#ifndef _WIN32
std::chrono::nanoseconds expected_cb_time = {}; ///< Estimated time of next callback std::chrono::nanoseconds expected_cb_time = {}; ///< Estimated time of next callback
#endif
}; };
using StreamPtr = std::shared_ptr<Stream>; using StreamPtr = std::shared_ptr<Stream>;