I'm implementing Video Call using the Pjsip library version 2.10, with the H264 codec (OpenH264 version 2.1.0)
I'm facing an issue with the video call, where it always displays a green screen before the video streaming actually start. I want to change the green frames to black.
I tried to apply some suggested solutions that appeared with me during the search process, by doing some modify on the file (pjmedia/src/pjmedia/vid_port.c) before building Pjsip, but it doesn't work with me, there is no change happened, the green frames still appear.
So please can anyone help me with this, thank you in advance!
Edit: Some of different solutions I have tried
1- The following code according to the Pjsip link http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2016-August/019417.html
if (need_frame_buf) {
.....
vp->frm_buf->type = PJMEDIA_FRAME_TYPE_NONE;
/* Insert the below code after you find the above line ---- */
/* Note: this will only work for I420 format */
if (vparam.fmt.id == PJMEDIA_FORMAT_I420) {
pj_memset(vp->frm_buf->buf, 0x80, vp->frm_buf_size);
pj_bzero(vp->frm_buf->buf,
vparam.fmt.det.vid.size.w*vparam.fmt.det.vid.size.h);
}
/* ---- */
2- Change the code bellow from:
/* pjmedia_vid_port_start(vp); */
pjmedia_vid_dev_stream_start(vp->strm);
To:
pjmedia_vid_port_start(vp);
/* pjmedia_vid_dev_stream_start(vp->strm); */
To reach the fuction pjmedia_vid_port_start():
PJ_DEF(pj_status_t) pjmedia_vid_port_start(pjmedia_vid_port *vp)
{
pj_status_t status;
PJ_ASSERT_RETURN(vp, PJ_EINVAL);
status = pjmedia_vid_dev_stream_start(vp->strm);
if (status != PJ_SUCCESS)
goto on_error;
/* Initialize buffer with black color */
{
const pjmedia_video_format_info *vfi;
const pjmedia_format *fmt;
pjmedia_video_apply_fmt_param vafp;
pjmedia_frame frame;
pj_bzero(&frame, sizeof(pjmedia_frame));
frame.buf = vp->frm_buf->buf;
frame.size = vp->frm_buf_size;
fmt = &vp->conv.conv_param.src;
status = get_vfi(fmt, &vfi, &vafp);
if (status == PJ_SUCCESS && frame.buf) {
frame.type = PJMEDIA_FRAME_TYPE_VIDEO;
pj_assert(frame.size >= vafp.framebytes);
frame.size = vafp.framebytes;
if (vfi->color_model == PJMEDIA_COLOR_MODEL_RGB) {
pj_memset(frame.buf, 0, vafp.framebytes);
} else if (fmt->id == PJMEDIA_FORMAT_I420 ||
fmt->id == PJMEDIA_FORMAT_YV12)
{
pj_memset(frame.buf, 16, vafp.plane_bytes[0]);
pj_memset((pj_uint8_t*)frame.buf + vafp.plane_bytes[0],
0x80, vafp.plane_bytes[1] * 2);
}
}
}
if (vp->clock) {
status = pjmedia_clock_start(vp->clock);
if (status != PJ_SUCCESS)
goto on_error;
}
return PJ_SUCCESS;
on_error:
pjmedia_vid_port_stop(vp);
return status;
}