switch (msg->message_id) {
-#if 0
+#if 1
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
{
- const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control>\n<vc_primitive>\n<to_encoder>\n<picture_fast_update>\n</picture_fast_update>\n</to_encoder>\n</vc_primitive>\n</media_control>";
+ //const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control>\n<vc_primitive>\n<to_encoder>\n<picture_fast_update>\n</picture_fast_update>\n</to_encoder>\n</vc_primitive>\n</media_control>";
+ const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control><vc_primitive><to_encoder><picture_fast_update /></to_encoder></vc_primitive></media_control>\n";
time_t now = switch_epoch_time_now(NULL);
if (!tech_pvt->last_vid_info || (now - tech_pvt->last_vid_info) > 1) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA");
+ if (switch_true(switch_channel_get_variable(channel, "video_mirror_input"))) {
+ switch_channel_set_flag(channel, CF_VIDEO_MIRROR_INPUT);
+ }
+
if (channel->caller_profile && channel->caller_profile->times) {
switch_mutex_lock(channel->profile_mutex);
channel->caller_profile->times->progress_media = switch_micro_time_now();
switch_channel_check_zrtp(channel);
switch_channel_set_flag(channel, CF_ANSWERED);
+ if (switch_true(switch_channel_get_variable(channel, "video_mirror_input"))) {
+ switch_channel_set_flag(channel, CF_VIDEO_MIRROR_INPUT);
+ //switch_channel_set_flag(channel, CF_VIDEO_DECODED_READ);
+ }
+
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_ANSWER) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_status_t status;
switch_frame_t *read_frame;
switch_media_handle_t *smh;
- uint32_t loops = 0, xloops = 0, vloops = 0, viloops = 0;
+ uint32_t loops = 0, xloops = 0, vloops = 0;
switch_frame_t fr = { 0 };
unsigned char *buf = NULL;
switch_image_t *blank_img = NULL;
switch_rgb_color_t bgcolor;
switch_rtp_engine_t *v_engine = NULL;
- switch_color_set_rgb(&bgcolor, "#000000");
- blank_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 320, 240, 1);
+ switch_color_set_rgb(&bgcolor, "#0000FF");
+ blank_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 352, 288, 1);
switch_img_fill(blank_img, 0, 0, blank_img->d_w, blank_img->d_h, &bgcolor);
if (!(smh = session->media_handle)) {
continue;
}
- if (read_frame->img) {
- if (++viloops > 10) {
- switch_channel_set_flag(channel, CF_VIDEO_READY);
- smh->vid_params.width = read_frame->img->d_w;
- smh->vid_params.height = read_frame->img->d_h;
- }
+ if (read_frame->img && read_frame->img->d_w && read_frame->img->d_h) {
+ switch_channel_set_flag(channel, CF_VIDEO_READY);
+ smh->vid_params.width = read_frame->img->d_w;
+ smh->vid_params.height = read_frame->img->d_h;
}
}
if (switch_channel_test_flag(session->channel, CF_VIDEO_READY) && smh->vid_params.width &&
switch_channel_test_flag(session->channel, CF_VIDEO_MIRROR_INPUT) &&
(smh->vid_params.width * smh->vid_params.height) < (img->d_w * img->d_h)) {
-
+
switch_img_copy(img, &dup_img);
switch_img_fit(&dup_img, smh->vid_params.width, smh->vid_params.height);
+
img = dup_img;
}