Commit 350bc637 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix race condition

parent b4c77370
......@@ -859,6 +859,7 @@ MS2_PUBLIC VideoPreview * video_preview_new(void);
#define video_preview_set_fps(p,fps) video_stream_set_fps((VideoStream*)p,fps)
#define video_preview_set_device_rotation(p, r) video_stream_set_device_rotation(p, r)
MS2_PUBLIC void video_preview_start(VideoPreview *stream, MSWebCam *device);
MS2_PUBLIC MSVideoSize video_preview_get_current_size(VideoPreview *stream);
MS2_PUBLIC void video_preview_stop(VideoPreview *stream);
/**
......
......@@ -327,9 +327,10 @@ static void video_capture_process(MSFilter *f){
static void video_capture_postprocess(MSFilter *f){
ms_message("Postprocessing of Android VIDEO capture filter");
AndroidReaderContext* d = getContext(f);
ms_mutex_lock(&d->mutex);
JNIEnv *env = ms_get_jni_env();
ms_mutex_lock(&d->mutex);
if (d->androidCamera) {
jmethodID method = env->GetStaticMethodID(d->helperClass,"stopRecording", "(Ljava/lang/Object;)V");
......@@ -464,9 +465,13 @@ extern "C" {
JNIEXPORT void JNICALL Java_org_linphone_mediastream_video_capture_AndroidVideoApi5JniWrapper_putImage(JNIEnv* env,
jclass thiz,jlong nativePtr,jbyteArray frame) {
AndroidReaderContext* d = (AndroidReaderContext*) nativePtr;
if (!d->androidCamera)
return;
ms_mutex_lock(&d->mutex);
if (!d->androidCamera){
ms_mutex_unlock(&d->mutex);
return;
}
if (!ms_video_capture_new_frame(&d->fpsControl,d->filter->ticker->time)) {
ms_mutex_unlock(&d->mutex);
......
......@@ -1145,6 +1145,13 @@ VideoPreview * video_preview_new(void){
return stream;
}
MSVideoSize video_preview_get_current_size(VideoPreview *stream){
MSVideoSize ret={0};
if (stream->source){
ms_filter_call_method(stream->source,MS_FILTER_GET_VIDEO_SIZE,&ret);
}
return ret;
}
void video_preview_start(VideoPreview *stream, MSWebCam *device){
MSPixFmt format;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment