Skip to content
Snippets Groups Projects
Commit f2e3ae16 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2598] Protect record and playback pointers in stop audio streams

parent 372a7cc1
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,7 @@ static void stream_moved_callback(pa_stream *s UNUSED, void *userdata UNUSED) ...@@ -58,7 +58,7 @@ static void stream_moved_callback(pa_stream *s UNUSED, void *userdata UNUSED)
static void playback_underflow_callback (pa_stream* s, void* userdata UNUSED) static void playback_underflow_callback (pa_stream* s, void* userdata UNUSED)
{ {
_debug ("Audio: Buffer Underflow"); _debug ("Audio: Buffer Underflow");
pa_stream_trigger (s, NULL, NULL);
} }
...@@ -292,7 +292,6 @@ bool PulseLayer::disconnectAudioStream (void) ...@@ -292,7 +292,6 @@ bool PulseLayer::disconnectAudioStream (void)
_info("Audio: Disconnect audio stream"); _info("Audio: Disconnect audio stream");
closePlaybackStream(); closePlaybackStream();
closeCaptureStream(); closeCaptureStream();
if (!playback && !record) if (!playback && !record)
...@@ -305,7 +304,6 @@ bool PulseLayer::disconnectAudioStream (void) ...@@ -305,7 +304,6 @@ bool PulseLayer::disconnectAudioStream (void)
void PulseLayer::closeCaptureStream (void) void PulseLayer::closeCaptureStream (void)
{ {
if (record) { if (record) {
delete record; delete record;
record=NULL; record=NULL;
} }
...@@ -315,7 +313,6 @@ void PulseLayer::closeCaptureStream (void) ...@@ -315,7 +313,6 @@ void PulseLayer::closeCaptureStream (void)
void PulseLayer::closePlaybackStream (void) void PulseLayer::closePlaybackStream (void)
{ {
if (playback) { if (playback) {
delete playback; delete playback;
playback=NULL; playback=NULL;
} }
...@@ -360,7 +357,10 @@ PulseLayer::stopStream (void) ...@@ -360,7 +357,10 @@ PulseLayer::stopStream (void)
{ {
_info("Audio: Stop audio stream"); _info("Audio: Stop audio stream");
if(playback)
pa_stream_flush (playback->pulseStream(), NULL, NULL); pa_stream_flush (playback->pulseStream(), NULL, NULL);
if(record)
pa_stream_flush (record->pulseStream(), NULL, NULL); pa_stream_flush (record->pulseStream(), NULL, NULL);
disconnectAudioStream(); disconnectAudioStream();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment