summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-23 17:12:07 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-10-23 17:12:07 +0000
commitffe69a6240de9e6bb56b9b729b8133fb323cee80 (patch)
tree0e15912d318c516fb7b61aa04a77a055784afbb0
parent21f5377d66e8c8166e2b061d46a438cdb3ca45a5 (diff)
no hang on open device patch
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@113 f606c939-3180-4ac9-a4b8-4b8779d57d0a
-rw-r--r--rMD-exp/src/capture_sound.c4
-rw-r--r--rMD-exp/src/opendev.c2
-rw-r--r--rMD-exp/src/recordmydesktop.c14
3 files changed, 14 insertions, 6 deletions
diff --git a/rMD-exp/src/capture_sound.c b/rMD-exp/src/capture_sound.c
index f28ba26..3bda596 100644
--- a/rMD-exp/src/capture_sound.c
+++ b/rMD-exp/src/capture_sound.c
@@ -57,7 +57,9 @@ void *CaptureSound(void *pdata){
NULL//let's hope that the device capabilities didn't magically change
);
if(((ProgData *)pdata)->sound_handle==NULL){
- fprintf(stderr,"Couldn't reopen sound device.\nThere will be no sound data from this point on.\n");
+ fprintf(stderr,"Couldn't reopen sound device.Exiting\n");
+ ((ProgData *)pdata)->running=0;
+ errno=3;
pthread_exit(&errno);
}
}
diff --git a/rMD-exp/src/opendev.c b/rMD-exp/src/opendev.c
index 9f8aa17..7eb5d2b 100644
--- a/rMD-exp/src/opendev.c
+++ b/rMD-exp/src/opendev.c
@@ -40,7 +40,7 @@ snd_pcm_t *OpenDev(const char *pcm_dev,unsigned int *channels,unsigned int *freq
snd_pcm_hw_params_alloca(&hwparams);
snd_pcm_uframes_t buffsize=4096;
- if (snd_pcm_open(&mhandle, pcm_dev, SND_PCM_STREAM_CAPTURE, 0x0002)<0){
+ if (snd_pcm_open(&mhandle, pcm_dev, SND_PCM_STREAM_CAPTURE, SND_PCM_ASYNC)<0){
fprintf(stderr, "Couldn't open PCM device %s\n", pcm_dev);
return NULL;
}
diff --git a/rMD-exp/src/recordmydesktop.c b/rMD-exp/src/recordmydesktop.c
index 15292f9..c14f605 100644
--- a/rMD-exp/src/recordmydesktop.c
+++ b/rMD-exp/src/recordmydesktop.c
@@ -30,7 +30,7 @@
int main(int argc,char **argv){
ProgData pdata;
-
+ int exit_status=0;
if(XInitThreads ()==0){
fprintf(stderr,"Couldn't initialize thread support!\n");
exit(7);
@@ -198,9 +198,15 @@ int main(int argc,char **argv){
// pthread_join(image_encode_t,NULL);
fprintf(stderr,".");
if(!pdata.args.nosound){
- pthread_join(sound_capture_t,NULL);
+ int *snd_exit;
+ pthread_join(sound_capture_t,(&snd_exit));
fprintf(stderr,".");
-// pthread_join(sound_encode_t,NULL);
+// if(!(*snd_exit))
+// pthread_join(sound_encode_t,NULL);
+// else{
+// pthread_cancel(sound_encode_t);
+// exit_status=*snd_exit;
+// }
fprintf(stderr,".");
}
else
@@ -230,7 +236,7 @@ int main(int argc,char **argv){
else
fprintf(stderr,"Goodbye!\n");
}
- return 0;
+ return exit_status;
}
© All Rights Reserved