зеркало из https://github.com/mozilla/gecko-dev.git
Bug 562488 - Fix crash destroying stream in OSS sydneyaudio backend. r=kinetik
This commit is contained in:
Родитель
ed563da884
Коммит
c2dae54c1a
|
@ -27,3 +27,5 @@ bug495558_alsa_endian.patch adds support for big endian ALSA platforms.
|
|||
bug526411_latency.patch: reduce requested latency to 250ms to match OGGPLAY_AUDIO_OFFSET.
|
||||
|
||||
sydney_aix.patch: Bug 499266 - add support for AIX 5.x
|
||||
|
||||
bug562488_oss_destroy_crash.patch: Fix crash in OSS backend when destroying stream.
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
diff --git a/media/libsydneyaudio/src/sydney_audio_oss.c b/media/libsydneyaudio/src/sydney_audio_oss.c
|
||||
--- a/media/libsydneyaudio/src/sydney_audio_oss.c
|
||||
+++ b/media/libsydneyaudio/src/sydney_audio_oss.c
|
||||
@@ -253,39 +253,44 @@ sa_stream_open(sa_stream_t *s) {
|
||||
|
||||
return SA_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
sa_stream_destroy(sa_stream_t *s) {
|
||||
int result = SA_SUCCESS;
|
||||
+ pthread_t thread_id;
|
||||
|
||||
if (s == NULL) {
|
||||
return SA_SUCCESS;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&s->mutex);
|
||||
|
||||
+ thread_id = s->thread_id;
|
||||
+
|
||||
/*
|
||||
- * This causes the thread sending data to ALSA to stop
|
||||
+ * This causes the thread sending data to OSS to stop
|
||||
*/
|
||||
s->thread_id = 0;
|
||||
|
||||
/*
|
||||
* Shut down the audio output device.
|
||||
*/
|
||||
if (s->output_fd != -1) {
|
||||
if (s->playing && close(s->output_fd) < 0) {
|
||||
result = SA_ERROR_SYSTEM;
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&s->mutex);
|
||||
|
||||
+ pthread_join(thread_id, NULL);
|
||||
+
|
||||
/*
|
||||
* Release resources.
|
||||
*/
|
||||
if (pthread_mutex_destroy(&s->mutex) != 0) {
|
||||
result = SA_ERROR_SYSTEM;
|
||||
}
|
||||
while (s->bl_head != NULL) {
|
||||
sa_buf * next = s->bl_head->next;
|
|
@ -258,6 +258,7 @@ sa_stream_open(sa_stream_t *s) {
|
|||
int
|
||||
sa_stream_destroy(sa_stream_t *s) {
|
||||
int result = SA_SUCCESS;
|
||||
pthread_t thread_id;
|
||||
|
||||
if (s == NULL) {
|
||||
return SA_SUCCESS;
|
||||
|
@ -265,8 +266,10 @@ sa_stream_destroy(sa_stream_t *s) {
|
|||
|
||||
pthread_mutex_lock(&s->mutex);
|
||||
|
||||
thread_id = s->thread_id;
|
||||
|
||||
/*
|
||||
* This causes the thread sending data to ALSA to stop
|
||||
* This causes the thread sending data to OSS to stop
|
||||
*/
|
||||
s->thread_id = 0;
|
||||
|
||||
|
@ -281,6 +284,8 @@ sa_stream_destroy(sa_stream_t *s) {
|
|||
|
||||
pthread_mutex_unlock(&s->mutex);
|
||||
|
||||
pthread_join(thread_id, NULL);
|
||||
|
||||
/*
|
||||
* Release resources.
|
||||
*/
|
||||
|
|
|
@ -14,3 +14,4 @@ patch -p3 <bug495558_alsa_endian.patch
|
|||
patch -p3 <bug525401_drain_deadlock.patch
|
||||
patch -p3 <bug526411_latency.patch
|
||||
patch -p3 <sydney_aix.patch
|
||||
patch -p3 <bug562488_oss_destroy_crash.patch
|
||||
|
|
Загрузка…
Ссылка в новой задаче