diff --git a/media/audio/pulse/pulse_util.cc b/media/audio/pulse/pulse_util.cc index beaf50810e707..b9d1c7df89173 100644 --- a/media/audio/pulse/pulse_util.cc +++ b/media/audio/pulse/pulse_util.cc @@ -676,11 +676,9 @@ void MuteAllSinksExcept(pa_threaded_mainloop* mainloop, }, (void*)&exclude_sink_name); + // WaitForOperationCompletion() consumes the caller's reference and unrefs + // `op` on every exit path; do NOT unref again here. WaitForOperationCompletion(mainloop, op, context); - // Clean up the operation after completion - if (op) { - pa_operation_unref(op); - } } // Unmutes all audio output sinks in the system. @@ -715,11 +713,9 @@ void UnmuteAllSinks(pa_threaded_mainloop* mainloop, pa_context* context) { mainloop // Pass mainloop as userdata ); + // WaitForOperationCompletion() consumes the caller's reference and unrefs + // `op` on every exit path; do NOT unref again here. WaitForOperationCompletion(mainloop, op, context); - // Wait for the operation to complete to ensure all sinks are unmuted. - if (op) { - pa_operation_unref(op); - } } std::string GetBusOfInput(pa_threaded_mainloop* mainloop,