summaryrefslogtreecommitdiff
path: root/graphics/transcode/patches/patch-as
blob: 2ef4b43fe2970d4ca44bc37a83c06d60f830923e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$NetBSD: patch-as,v 1.2 2004/03/28 20:09:07 mycroft Exp $

--- src/decoder.c.orig	2003-12-20 11:49:22.000000000 +0000
+++ src/decoder.c	2004-03-28 09:16:35.000000000 +0000
@@ -119,16 +119,12 @@
   }
 
   //wait for threads to terminate
-#ifdef BROKEN_PTHREADS // Used to be MacOSX specific; kernel 2.6 as well?
   pthread_cond_signal(&vframe_list_full_cv);
-#endif
   cc1=pthread_join(vthread, &status);
   
   if(verbose & TC_DEBUG) fprintf(stderr, "(%s) video thread exit (ret_code=%d) (status_code=%d)\n", __FILE__, cc1, (int) status);
   
-#ifdef BROKEN_PTHREADS // Used to be MacOSX specific; kernel 2.6 as well?
   pthread_cond_signal(&aframe_list_full_cv);
-#endif
   cc2=pthread_join(athread, &status);
   
   if(verbose & TC_DEBUG) fprintf(stderr, "(%s) audio thread exit (ret_code=%d) (status_code=%d)\n", __FILE__, cc2, (int) status);
@@ -467,6 +463,7 @@
     pthread_testcancel();
 
     //check buffer fill level
+    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
     pthread_mutex_lock(&vframe_list_lock);
     
     while(vframe_fill_level(TC_BUFFER_FULL)) {
@@ -481,7 +478,9 @@
 	  pthread_exit( (int *) 11);
 	}
     }
+
     pthread_mutex_unlock(&vframe_list_lock);
+    pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
     
     // get a frame buffer or wait
     while((ptr = vframe_register(i))==NULL) {
@@ -655,6 +654,7 @@
     pthread_testcancel();
     
     //check buffer fill level
+    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
     pthread_mutex_lock(&aframe_list_lock);
     
     while(aframe_fill_level(TC_BUFFER_FULL)) {
@@ -671,6 +671,7 @@
     }
     
     pthread_mutex_unlock(&aframe_list_lock);
+    pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
     
     // get a frame buffer or wait
     while((ptr = aframe_register(i))==NULL) {