Changeset 5868
- Timestamp:
- Aug 28, 2018 2:00:05 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/vid_port.c
r5866 r5868 166 166 } 167 167 168 static pj_status_t get_vafp(const pjmedia_format *fmt, 169 pjmedia_video_apply_fmt_param *vafp) 168 static pj_status_t get_vfi(const pjmedia_format *fmt, 169 const pjmedia_video_format_info **p_vfi, 170 pjmedia_video_apply_fmt_param *vafp) 170 171 { 171 172 const pjmedia_video_format_info *vfi; … … 174 175 if (!vfi) 175 176 return PJMEDIA_EBADFMT; 177 178 if (p_vfi) *p_vfi = vfi; 176 179 177 180 pj_bzero(vafp, sizeof(*vafp)); … … 212 215 213 216 /* Allocate buffer for conversion */ 214 status = get_v afp(&vp->conv.conv_param.dst, &vafp);217 status = get_vfi(&vp->conv.conv_param.dst, NULL, &vafp); 215 218 if (status != PJ_SUCCESS) 216 219 return status; … … 656 659 pjmedia_video_apply_fmt_param vafp; 657 660 658 status = get_v afp(&vp->conv.conv_param.src, &vafp);661 status = get_vfi(&vp->conv.conv_param.src, NULL, &vafp); 659 662 if (status != PJ_SUCCESS) 660 663 goto on_error; … … 773 776 goto on_error; 774 777 775 if ((vp->dir & PJMEDIA_DIR_RENDER) && 776 (vp->conv.conv_param.dst.id == PJMEDIA_FORMAT_I420 || 777 vp->conv.conv_param.dst.id == PJMEDIA_FORMAT_YV12)) 778 /* Initialize buffer with black color */ 778 779 { 780 const pjmedia_video_format_info *vfi; 781 const pjmedia_format *fmt; 779 782 pjmedia_video_apply_fmt_param vafp; 780 783 pj_status_t status; … … 782 785 783 786 pj_bzero(&frame, sizeof(pjmedia_frame)); 784 frame.buf = (vp->conv.conv? vp->conv.conv_buf: vp->frm_buf->buf);785 frame.size = (vp->conv.conv? vp->conv.conv_buf_size:786 vp->frm_buf_size); 787 788 status = get_v afp(&vp->conv.conv_param.dst, &vafp);787 frame.buf = vp->frm_buf->buf; 788 frame.size = vp->frm_buf_size; 789 790 fmt = &vp->conv.conv_param.src; 791 status = get_vfi(fmt, &vfi, &vafp); 789 792 if (status == PJ_SUCCESS && frame.buf) { 790 793 frame.type = PJMEDIA_FRAME_TYPE_VIDEO; … … 792 795 frame.size = vafp.framebytes; 793 796 794 /* Black initial render screen for I420/YV12 format */ 795 pj_memset(frame.buf, 16, vafp.plane_bytes[0]); 796 pj_memset((pj_uint8_t*)frame.buf + vafp.plane_bytes[0], 797 0x80, vafp.plane_bytes[1] * 2); 798 799 pjmedia_vid_dev_stream_put_frame(vp->strm, &frame); 797 if (vfi->color_model == PJMEDIA_COLOR_MODEL_RGB) { 798 pj_memset(frame.buf, 0, vafp.framebytes); 799 } else if (fmt->id == PJMEDIA_FORMAT_I420 || 800 fmt->id == PJMEDIA_FORMAT_YV12) 801 { 802 pj_memset(frame.buf, 16, vafp.plane_bytes[0]); 803 pj_memset((pj_uint8_t*)frame.buf + vafp.plane_bytes[0], 804 0x80, vafp.plane_bytes[1] * 2); 805 } 800 806 } 801 807 }
Note: See TracChangeset
for help on using the changeset viewer.