+void CPulseAudioClient::resetStreamCallbacks() {
+ if (!__mpStream)
+ return;
+
+ if (__mDirection == EStreamDirection::STREAM_DIRECTION_PLAYBACK)
+ pa_stream_set_write_callback(__mpStream, NULL, NULL);
+ else
+ pa_stream_set_read_callback(__mpStream, NULL, NULL);
+
+ pa_stream_set_latency_update_callback(__mpStream, NULL, NULL);
+ pa_stream_set_event_callback(__mpStream, NULL, NULL);
+}
+
+void CPulseAudioClient::resetInternalObjects() {
+ if (__mpMainloop)
+ pa_threaded_mainloop_stop(__mpMainloop);
+
+ if (__mpStream) {
+ pa_stream_disconnect(__mpStream);
+ pa_stream_unref(__mpStream);
+ __mpStream = nullptr;
+ }
+
+ if (__mpContext) {
+ pa_context_disconnect(__mpContext);
+ pa_context_unref(__mpContext);
+ __mpContext = nullptr;
+ }
+
+ if (__mpMainloop) {
+ pa_threaded_mainloop_free(__mpMainloop);
+ __mpMainloop = nullptr;
+ }
+
+ if (__mpPropList) {
+ pa_proplist_free(__mpPropList);
+ __mpPropList = nullptr;
+ }
+}
+