- Timestamp:
- Mar 29, 2012 8:22:35 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/vid_port.c
r3905 r3992 283 283 goto on_error; 284 284 285 if (vp->role==ROLE_ACTIVE && vp->stream_role==ROLE_PASSIVE) { 285 if (vp->role==ROLE_ACTIVE && 286 ((vp->dir & PJMEDIA_DIR_ENCODING) || vp->stream_role==ROLE_PASSIVE)) 287 { 286 288 pjmedia_clock_param param; 287 289 288 290 /* Active role is wanted, but our device is passive, so create 289 * master clocks to run the media flow. 291 * master clocks to run the media flow. For encoding direction, 292 * we also want to create our own clock since the device's clock 293 * may run at a different rate. 290 294 */ 291 295 need_frame_buf = PJ_TRUE; … … 669 673 */ 670 674 pjmedia_vid_port *vp = (pjmedia_vid_port*)user_data; 675 pjmedia_frame frame_; 671 676 pj_status_t status; 672 677 … … 685 690 //save_rgb_frame(vp->cap_size.w, vp->cap_size.h, vp->frm_buf); 686 691 687 vidstream_cap_cb(vp->strm, vp, vp->frm_buf); 692 status = convert_frame(vp, vp->frm_buf, &frame_); 693 if (status != PJ_SUCCESS) 694 return; 695 696 status = pjmedia_port_put_frame(vp->client_port, 697 (vp->conv? &frame_: vp->frm_buf)); 698 if (status != PJ_SUCCESS) 699 return; 688 700 } 689 701 … … 718 730 pjmedia_vid_port *vp = (pjmedia_vid_port*)user_data; 719 731 720 if (vp->role==ROLE_ACTIVE) { 721 pj_status_t status; 722 pjmedia_frame frame_; 723 724 status = convert_frame(vp, frame, &frame_); 725 if (status != PJ_SUCCESS) 726 return status; 727 728 if (vp->client_port) 729 status = pjmedia_port_put_frame(vp->client_port, 730 (vp->conv? &frame_: frame)); 731 if (status != PJ_SUCCESS) 732 return status; 733 } else { 734 /* We are passive while the stream is active so we just store the 735 * frame in the buffer. 736 * The decoding counterpart is located in vid_pasv_port_put_frame() 737 */ 738 copy_frame_to_buffer(vp, frame); 739 } 732 /* We just store the frame in the buffer. For active role, we let 733 * video port's clock to push the frame buffer to the user. 734 * The decoding counterpart for passive role and active stream is 735 * located in vid_pasv_port_put_frame() 736 */ 737 copy_frame_to_buffer(vp, frame); 738 740 739 /* This is tricky since the frame is still in its original unconverted 741 740 * format, which may not be what the application expects.
Note: See TracChangeset
for help on using the changeset viewer.