Changeset 3799 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c
- Timestamp:
- Oct 6, 2011 7:37:46 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c
r3793 r3799 1822 1822 pjmedia_event_unsubscribe(&call_med->esub_cap); 1823 1823 1824 /* = Detach stream port from the old capture device = */ 1825 status = pjmedia_vid_port_disconnect(w->vp_cap); 1826 if (status != PJ_SUCCESS) 1827 return status; 1828 1824 /* temporarily disconnect while we operate on the tee. */ 1825 pjmedia_vid_port_disconnect(w->vp_cap); 1826 1827 /* = Detach stream port from the old capture device's tee = */ 1829 1828 status = pjmedia_vid_tee_remove_dst_port(w->tee, media_port); 1830 1829 if (status != PJ_SUCCESS) { 1831 /* Connect back the old capturer */ 1832 pjmedia_vid_port_connect(w->vp_cap, media_port, PJ_FALSE); 1833 return status; 1834 } 1830 /* Something wrong, assume that media_port has been removed 1831 * and continue. 1832 */ 1833 PJ_PERROR(4,(THIS_FILE, status, 1834 "Warning: call %d: unable to remove video from tee", 1835 call->index)); 1836 } 1837 1838 /* Reconnect again immediately. We're done with w->tee */ 1839 pjmedia_vid_port_connect(w->vp_cap, w->tee, PJ_FALSE); 1835 1840 1836 1841 /* = Attach stream port to the new capture device = */ … … 1862 1867 goto on_error; 1863 1868 1864 /* Connect capturer to tee */1865 status = pjmedia_vid_port_connect(new_w->vp_cap, new_w->tee, PJ_FALSE);1866 if (status != PJ_SUCCESS)1867 return status;1868 1869 1869 if (w->vp_rend) { 1870 1870 /* Start renderer */ … … 1881 1881 1882 1882 /* Start capturer */ 1883 status = pjmedia_vid_port_start(new_w->vp_cap); 1884 if (status != PJ_SUCCESS) 1885 goto on_error; 1883 if (!pjmedia_vid_port_is_running(new_w->vp_cap)) { 1884 status = pjmedia_vid_port_start(new_w->vp_cap); 1885 if (status != PJ_SUCCESS) 1886 goto on_error; 1887 } 1886 1888 1887 1889 /* Finally */ … … 1893 1895 1894 1896 on_error: 1897 PJ_PERROR(4,(THIS_FILE, status, 1898 "Call %d: error changing capture device to %d", 1899 call->index, cap_dev)); 1900 1895 1901 if (new_w) { 1902 /* Unsubscribe, just in case */ 1903 pjmedia_event_unsubscribe(&call_med->esub_cap); 1896 1904 /* Disconnect media port from the new capturer */ 1897 1905 pjmedia_vid_tee_remove_dst_port(new_w->tee, media_port); … … 1901 1909 1902 1910 /* Revert back to the old capturer */ 1911 pjmedia_vid_port_disconnect(w->vp_cap); 1903 1912 status = pjmedia_vid_tee_add_dst_port2(w->tee, 0, media_port); 1913 pjmedia_vid_port_connect(w->vp_cap, w->tee, PJ_FALSE); 1904 1914 if (status != PJ_SUCCESS) 1905 1915 return status; 1906 1916 1907 status = pjmedia_vid_port_connect(w->vp_cap, w->tee, PJ_FALSE); 1908 if (status != PJ_SUCCESS) 1909 return status; 1917 #if ENABLE_EVENT 1918 /* Resubscribe */ 1919 pjmedia_event_subscribe( 1920 pjmedia_vid_port_get_event_publisher(w->vp_cap), 1921 &call_med->esub_cap); 1922 #endif 1910 1923 1911 1924 return status;
Note: See TracChangeset
for help on using the changeset viewer.