static void ms_ticker_stop(MSTicker *s){ ms_mutex_lock(&s->lock); s->run=FALSE; ms_mutex_unlock(&s->lock); if(s->thread) ms_thread_join(s->thread,NULL); }
static void winsnd_stop_r(MSSndCard *card){ WinSndData *d=(WinSndData*)card->data; d->read_started=FALSE; if (d->write_started==FALSE){ ms_thread_join(d->thread,NULL); } }
static void oss_stop_w(MSSndCard *card){ OssData *d=(OssData*)card->data; d->write_started=FALSE; if (d->read_started==FALSE){ ms_thread_join(d->thread,NULL); } }
static void v4l_stop_capture(V4lState *s){ if (s->run){ s->run=FALSE; ms_thread_join(s->thread,NULL); ms_message("v4l thread has joined."); } }
static void _vfw_engine_unconfigure(VfwEngine *obj){ if (!capCaptureStop(obj->capvideo)){ ms_error("vfw: fail to stop capture !"); } obj->thread_running=FALSE; ms_thread_join(obj->thread,NULL); obj->configured=FALSE; }
void UDT_transport_disconnect(UDT_transport *udt) { udt->run=FALSE; ms_thread_join(udt->monitor_thread,NULL); UDT::close(udt->udt_socket); ms_free(udt); }
static void alsa_stop_r(AlsaReadData *d){ d->read_started=FALSE; if (d->thread!=0) { ms_thread_join(d->thread,NULL); d->thread=0; } }
static void winsnd_stop_w(MSSndCard *card){ WinSndData *d=(WinSndData*)card->data; d->write_started=FALSE; if (d->read_started==FALSE){ ms_thread_join(d->thread,NULL); } #ifdef CONTROLVOLUME waveOutSetVolume(d->waveoutdev, d->dwOldVolume); #endif }
static void msv4l2_postprocess(MSFilter *f){ V4l2State *s=(V4l2State*)f->data; s->thread_run = FALSE; if(s->thread) { ms_thread_join(s->thread,NULL); ms_message("msv4l2 thread has joined."); } else { ms_warning("msv4l2 thread was already stopped"); } flushq(&s->rq,0); }
static void sound_read_postprocess(MSFilter *f) { msandroid_sound_read_data *d=(msandroid_sound_read_data*)f->data; jmethodID stop_id=0; jmethodID release_id=0; //JNIEnv *jni_env = ms_get_jni_env(); JNIEnv *jni_env = NULL; JavaVM *jvm = ms_get_jvm(); if (jvm->AttachCurrentThread(&jni_env, NULL)!=0) { ms_fatal("AttachCurrentThread() failed !"); return; } ms_ticker_set_time_func(f->ticker,NULL,NULL); d->read_samples=0; //stop recording stop_id = jni_env->GetMethodID(d->audio_record_class,"stop", "()V"); if(stop_id==0) { ms_error("cannot find AudioRecord.stop() method"); goto end; } if (d->aec) { delete_hardware_echo_canceller(jni_env, d->aec); d->aec = NULL; } d->started = false; if (d->thread_id !=0) ms_thread_join(d->thread_id,0); if (d->audio_record) { jni_env->CallVoidMethod(d->audio_record,stop_id); //release recorder release_id = jni_env->GetMethodID(d->audio_record_class,"release", "()V"); if(release_id==0) { ms_error("cannot find AudioRecord.release() method"); goto end; } jni_env->CallVoidMethod(d->audio_record,release_id); } goto end; end: { if (d->audio_record) jni_env->DeleteGlobalRef(d->audio_record); jni_env->DeleteGlobalRef(d->audio_record_class); if (d->read_buff) jni_env->DeleteGlobalRef(d->read_buff); jvm->DetachCurrentThread(); return; } }
void linphone_gtk_uninit_instance(void){ if (server_pipe!=(ortp_pipe_t)-1){ ortp_pipe_t client; server_pipe_running=FALSE; /*this is to unblock the accept() of the server pipe*/ client=ortp_client_pipe_connect(pipe_name); ortp_pipe_write(client,(uint8_t*)" ",1); ortp_client_pipe_close(client); ms_thread_join(pipe_thread,NULL); server_pipe=(ortp_pipe_t)-1; g_free(pipe_name); pipe_name=NULL; } }
static void msv4l2_postprocess(MSFilter *f){ V4l2State *s=(V4l2State*)f->data; #ifdef V4L2_THREADED s->thread_run = FALSE; if(ms_thread_join(s->thread,NULL)) ms_warning("msv4l2 thread was already stopped"); else ms_message("msv4l2 thread has joined."); flushq(&s->rq,0); #else if (s->fd!=-1){ msv4l2_do_munmap(s); msv4l2_close(s); } #endif }
static void sound_read_postprocess(MSFilter *f){ msandroid_sound_read_data *d=(msandroid_sound_read_data*)f->data; jmethodID stop_id=0; jmethodID release_id=0; JNIEnv *jni_env = ms_get_jni_env(); ms_ticker_set_time_func(f->ticker,NULL,NULL); d->read_samples=0; //stop recording stop_id = jni_env->GetMethodID(d->audio_record_class,"stop", "()V"); if(stop_id==0) { ms_error("cannot find AudioRecord.stop() method"); goto end; } d->started = false; if (d->thread_id !=0) ms_thread_join(d->thread_id,0); if (d->audio_record) { jni_env->CallVoidMethod(d->audio_record,stop_id); //release recorder release_id = jni_env->GetMethodID(d->audio_record_class,"release", "()V"); if(release_id==0) { ms_error("cannot find AudioRecord.release() method"); goto end; } jni_env->CallVoidMethod(d->audio_record,release_id); } goto end; end: { if (d->audio_record) jni_env->DeleteGlobalRef(d->audio_record); jni_env->DeleteGlobalRef(d->audio_record_class); if (d->read_buff) jni_env->DeleteGlobalRef(d->read_buff); return; } }
void ec_calibrator_destroy(EcCalibrator *ecc) { ms_thread_join(ecc->thread,NULL); ms_free(ecc); }