From 49628fb304fd6ee043c9d64c9067f8e17bfdced3 Mon Sep 17 00:00:00 2001 From: Robert Wu <85952307+robertwu1@users.noreply.github.com> Date: Wed, 7 Jan 2026 15:16:28 -0800 Subject: [PATCH] Add check for disconnected stream in close method Prevent updating frame counters if the stream is disconnected. Fixes #2329 --- src/common/AudioStream.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/AudioStream.cpp b/src/common/AudioStream.cpp index b3f7e26e8..05666dd73 100644 --- a/src/common/AudioStream.cpp +++ b/src/common/AudioStream.cpp @@ -44,8 +44,11 @@ AudioStream::~AudioStream() { Result AudioStream::close() { closePerformanceHint(); // Update local counters so they can be read after the close. - updateFramesWritten(); - updateFramesRead(); + // But don't update the counters if the stream is disconnected. + if (mErrorCallbackResult != Result::ErrorDisconnected) { + updateFramesWritten(); + updateFramesRead(); + } return Result::OK; }