saki4510t / UVCCamera

library and sample to access to UVC web camera on non-rooted Android device
2.96k stars 1.19k forks source link

Get stuck at pthread_cond_wait(&preview_sync, &preview_mutex) for high resolution yuv video #638

Open zipswich opened 2 years ago

zipswich commented 2 years ago

usbCameraTest8 works fine for resolutions from 640x480 to 2320x1744. For 4656x3496, the pthread_cond_wait(&preview_sync, &preview_mutex) does not return:

Code from UVCPreview.cpp:

uvc_frame_t *UVCPreview::waitPreviewFrame() {
    uvc_frame_t *frame = NULL;
    pthread_mutex_lock(&preview_mutex);
    {
        LOGI("Streaming........ before previewFrames.size()...........................");
        if (!previewFrames.size()) {
           LOGI("Streaming........ pthread_cond_wait ...........................");
            pthread_cond_wait(&preview_sync, &preview_mutex);
        }
        LOGI("Streaming........ after previewFrames.size()...........................");
        if (LIKELY(isRunning() && previewFrames.size() > 0)) {
            frame = previewFrames.remove(0);
        }
        LOGI("Streaming........ success ...........................");
    }
    pthread_mutex_unlock(&preview_mutex);
    return frame;
}

Could anyone offer a clue?