Changeset 4009 for pjproject/trunk
- Timestamp:
- Apr 3, 2012 7:33:31 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/vid_port.c
r3993 r4009 126 126 static pj_status_t create_converter(pjmedia_vid_port *vp) 127 127 { 128 if (vp->conv) { 129 pjmedia_converter_destroy(vp->conv); 130 vp->conv = NULL; 131 } 132 128 133 /* Instantiate converter if necessary */ 129 134 if (vp->conv_param.src.id != vp->conv_param.dst.id || … … 136 141 const pjmedia_video_format_info *vfi; 137 142 pjmedia_video_apply_fmt_param vafp; 138 139 if (vp->conv) {140 pjmedia_converter_destroy(vp->conv);141 vp->conv = NULL;142 }143 143 144 144 status = pjmedia_converter_create(NULL, vp->pool, &vp->conv_param, … … 564 564 if (event->type == PJMEDIA_EVENT_FMT_CHANGED) { 565 565 const pjmedia_video_format_detail *vfd; 566 pjmedia_vid_dev_param vid_param; 566 567 pj_status_t status; 567 568 … … 569 570 570 571 /* Retrieve the video format detail */ 571 vfd = pjmedia_format_get_video_format_detail( &vp->client_port->info.fmt,572 573 if (!vfd )572 vfd = pjmedia_format_get_video_format_detail( 573 &event->data.fmt_changed.new_fmt, PJ_TRUE); 574 if (!vfd || !vfd->fps.num || !vfd->fps.denum) 574 575 return PJMEDIA_EVID_BADFORMAT; 575 pj_assert(vfd->fps.num);576 576 577 577 /* Change the destination format to the new format */ 578 578 pjmedia_format_copy(&vp->conv_param.src, 579 & vp->client_port->info.fmt);579 &event->data.fmt_changed.new_fmt); 580 580 /* Only copy the size here */ 581 581 vp->conv_param.dst.det.vid.size = 582 vp->client_port->info.fmt.det.vid.size,582 event->data.fmt_changed.new_fmt.det.vid.size; 583 583 584 584 status = create_converter(vp); … … 587 587 return status; 588 588 } 589 590 status = pjmedia_vid_dev_stream_set_cap(vp->strm, 591 PJMEDIA_VID_DEV_CAP_FORMAT, 592 &vp->conv_param.dst); 593 if (status != PJ_SUCCESS) { 594 PJ_LOG(3, (THIS_FILE, "failure in changing the format of the " 595 "video device")); 596 PJ_LOG(3, (THIS_FILE, "reverting to its original format: %s", 597 status != PJMEDIA_EVID_ERR ? "success" : 598 "failure")); 599 return status; 589 590 pjmedia_vid_dev_stream_get_param(vp->strm, &vid_param); 591 if (vid_param.fmt.id != vp->conv_param.dst.id || 592 (vid_param.fmt.det.vid.size.h != 593 vp->conv_param.dst.det.vid.size.h) || 594 (vid_param.fmt.det.vid.size.w != 595 vp->conv_param.dst.det.vid.size.w)) 596 { 597 status = pjmedia_vid_dev_stream_set_cap(vp->strm, 598 PJMEDIA_VID_DEV_CAP_FORMAT, 599 &vp->conv_param.dst); 600 if (status != PJ_SUCCESS) { 601 PJ_LOG(3, (THIS_FILE, "failure in changing the format of the " 602 "video device")); 603 PJ_LOG(3, (THIS_FILE, "reverting to its original format: %s", 604 status != PJMEDIA_EVID_ERR ? "success" : 605 "failure")); 606 return status; 607 } 600 608 } 601 609 602 610 if (vp->stream_role == ROLE_PASSIVE) { 603 pjmedia_vid_dev_param vid_param;604 611 pjmedia_clock_param clock_param; 605 612 … … 610 617 */ 611 618 /* Adjust the clock */ 612 pjmedia_vid_dev_stream_get_param(vp->strm, &vid_param);613 619 clock_param.usec_interval = PJMEDIA_PTIME(&vfd->fps); 614 620 clock_param.clock_rate = vid_param.clock_rate;
Note: See TracChangeset
for help on using the changeset viewer.