Changeset 4853 for pjproject/trunk
- Timestamp:
- May 30, 2014 6:13:24 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-videodev/ios_dev.m
r4838 r4853 724 724 pj_bool_t native_preview = *((pj_bool_t *)pval); 725 725 726 if (!strm->cap_session) return PJ_EINVAL; 727 728 if (!native_preview || strm->render_view) 726 /* Disable native preview */ 727 if (!native_preview) { 728 if (strm->prev_layer) { 729 CALayer *prev_layer = strm->prev_layer; 730 dispatch_async(dispatch_get_main_queue(), ^{ 731 [prev_layer removeFromSuperlayer]; 732 [prev_layer release]; 733 }); 734 strm->prev_layer = nil; 735 PJ_LOG(4, (THIS_FILE, "Native preview deinitialized")); 736 } 729 737 return PJ_SUCCESS; 730 731 /* Create view */ 732 ios_init_view(strm); 738 } 739 740 /* Enable native preview */ 741 742 /* Verify if it is already enabled */ 743 if (strm->prev_layer) 744 return PJ_SUCCESS; 745 746 /* Verify capture session instance availability */ 747 if (!strm->cap_session) 748 return PJ_EINVALIDOP; 749 750 /* Create view, if none */ 751 if (!strm->render_view) 752 ios_init_view(strm); 753 733 754 734 755 /* Preview layer instantiation should be in main thread! */ … … 744 765 [strm->render_view.layer addSublayer:prev_layer]; 745 766 strm->prev_layer = prev_layer; 746 PJ_LOG(4, (THIS_FILE, "Native preview initialized"));747 767 }); 768 PJ_LOG(4, (THIS_FILE, "Native preview initialized")); 748 769 749 770 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.