void videoCapturerDestory()

in source/T31/T31VideoCapturer.c [388:423]


void videoCapturerDestory(VideoCapturerHandle handle)
{
    if (!handle) {
        return;
    }
    T31_HANDLE_GET(handle);

    if (t31Handle->status == VID_CAP_STATUS_STREAM_ON) {
        videoCapturerReleaseStream(handle);
    }

    setStatus(handle, VID_CAP_STATUS_NOT_READY);

    if (chn[t31Handle->channelNum].enable) {
        if (t31Handle->format != VID_FMT_RAW) {
            if (IMP_System_UnBind(&chn[t31Handle->channelNum].framesource_chn, &chn[t31Handle->channelNum].imp_encoder)) {
                LOG("UnBind FrameSource channel%d and Encoder failed");
            }
            sample_encoder_exit();
        }

        /*Destroy channel */
        if (IMP_FrameSource_DestroyChn(chn[t31Handle->channelNum].index)) {
            LOG("IMP_FrameSource_DestroyChn(%d) error", chn[t31Handle->channelNum].index);
        }
        chn[t31Handle->channelNum].enable = false;
    }

    ATOMIC_INT_SUB(&t31VideoSystemUser);

    if (!t31VideoSystemUser) {
        sample_system_exit();
    }

    free(handle);
}