Ignore:
Timestamp:
Mar 19, 2015 4:10:11 AM (10 years ago)
Author:
nanang
Message:

Fixed #1824: Convert global index to local index for fast-switching feature of video capture device.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c

    r4994 r4998  
    836836                                            const void *value) 
    837837{ 
     838    /* For fast switching, device global index needs to be converted to 
     839     * local index before forwarding the request to the device stream. 
     840     */ 
     841    if (cap == PJMEDIA_VID_DEV_CAP_SWITCH) { 
     842        pjmedia_vid_dev_factory *f; 
     843        unsigned local_idx; 
     844        pj_status_t status; 
     845        pjmedia_vid_dev_switch_param p = *(pjmedia_vid_dev_switch_param*)value; 
     846 
     847        status = lookup_dev(p.target_id, &f, &local_idx); 
     848        if (status != PJ_SUCCESS) 
     849            return status; 
     850 
     851        /* Make sure that current & target devices share the same factory */ 
     852        if (f->sys.drv_idx != strm->sys.drv_idx) 
     853            return PJMEDIA_EVID_INVDEV; 
     854 
     855        p.target_id = local_idx; 
     856        return strm->op->set_cap(strm, cap, &p); 
     857    } 
     858 
    838859    return strm->op->set_cap(strm, cap, value); 
    839860} 
Note: See TracChangeset for help on using the changeset viewer.