int member_id;
int idx;
int tagged;
+ int bugged;
int screen_w;
int screen_h;
int x_pos;
switch_assert(layer->img);
if (switch_img_scale(img, &layer->img, img_w, img_h) == SWITCH_STATUS_SUCCESS) {
+ if (layer->bugged && layer->member_id > -1) {
+ conference_member_t *member;
+ if ((member = conference_member_get(conference, layer->member_id))) {
+ switch_frame_t write_frame = { 0 };
+ write_frame.img = layer->img;
+ switch_core_media_bug_patch_video(member->session, &write_frame);
+ switch_thread_rwlock_unlock(member->rwlock);
+ }
+ }
switch_img_patch(IMG, layer->img, x_pos, y_pos);
}
} else {
img = imember->avatar_png_img;
}
-
+
+ layer = NULL;
+
if (img) {
int i;
- layer = NULL;
used++;
switch_mutex_lock(conference->canvas->mutex);
img = NULL;
layer->tagged = 1;
+
+ if (switch_core_media_bug_count(imember->session, "patch:video")) {
+ layer->bugged = 1;
+ }
}
}
}
layer->tagged = 0;
}
+ layer->bugged = 0;
}
}
write_frame.packetlen = 0;
//switch_core_session_write_video_frame(imember->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (switch_frame_buffer_dup(imember->fb, &write_frame, &dupframe) == SWITCH_STATUS_SUCCESS) {
switch_queue_push(imember->mux_out_queue, dupframe);
dupframe = NULL;
}
if (imember->session) {
- switch_core_session_rwunlock(imember->session);
+ switch_core_session_rwunlock(imember->session);
}
}
if (!text) text = overlay->text;
int len = strlen(text);
- if (len < 5) len = 5;
-
- width = (int) (float)(font_size * 0.75f * len);
+ if (len < 5) len = 5;
+ width = (int) (float)(font_size * .95f * len);
switch_color_set_rgb(&bgcolor, overlay->bg);
}
}
- if (context->debug || !context->overlay_count) {
+ if (context->rawImage && (context->debug || !context->overlay_count)) {
libyuv::RGB24ToI420((uint8_t *)context->rawImage->imageData, context->w * 3,
frame->img->planes[0], frame->img->stride[0],
frame->img->planes[1], frame->img->stride[1],
}
break;
case SWITCH_ABC_TYPE_READ_VIDEO_PING:
+ case SWITCH_ABC_TYPE_VIDEO_PATCH:
{
switch_frame_t *frame = switch_core_media_bug_get_video_ping_frame(bug);
video_thread_callback(context->session, frame, context);
int x, n;
char *argv[25] = { 0 };
int argc;
+ switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING;
+ const char *function = "mod_cv";
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_cv_bug_"))) {
if (!zstr(data) && !strcasecmp(data, "stop")) {
parse_params(context, 1, argc, argv);
}
+ if (!strcasecmp(argv[0], "patch") || !strcasecmp(argv[1], "patch")) {
+ function = "patch:video";
+ flags = SMBF_VIDEO_PATCH;
+ }
+
switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock);
- if ((status = switch_core_media_bug_add(session, "cv_bug", NULL, cv_bug_callback, context, 0, SMBF_READ_VIDEO_PING, &bug)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = switch_core_media_bug_add(session, function, NULL, cv_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock);
return;
char *nested_cascade_path = NULL;
char *lbuf = NULL;
int x, n, i;
+ switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING;
+ const char *function = "mod_cv";
if (zstr(cmd)) {
goto usage;
switch_channel_set_private(channel, "_cv_bug_", NULL);
switch_core_media_bug_remove(rsession, &bug);
stream->write_function(stream, "+OK Success\n");
- } else if (!strcasecmp(action, "start") || !strcasecmp(action, "mod")) {
+ } else if (!strcasecmp(action, "start") || !strcasecmp(action, "mod") || !strcasecmp(action, "patch")) {
context = (cv_context_t *) switch_core_media_bug_get_user_data(bug);
switch_assert(context);
parse_params(context, 2, argc, argv);
goto done;
}
- if (!zstr(action) && strcasecmp(action, "start")) {
+ if (!zstr(action) && strcasecmp(action, "start") && strcasecmp(action, "patch")) {
goto usage;
}
switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock);
- if ((status = switch_core_media_bug_add(rsession, "cv_bug", NULL, cv_bug_callback, context, 0, SMBF_READ_VIDEO_PING, &bug)) != SWITCH_STATUS_SUCCESS) {
+ if (!strcasecmp(action, "patch")) {
+ function = "patch:video";
+ flags = SMBF_VIDEO_PATCH;
+ }
+
+ if ((status = switch_core_media_bug_add(rsession, function, NULL,
+ cv_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Failure!\n");
switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock);
goto done;
return SWITCH_STATUS_FALSE;
}
+
SWITCH_DECLARE(uint32_t) switch_core_media_bug_count(switch_core_session_t *orig_session, const char *function)
{
switch_media_bug_t *bp;
return x;
}
+SWITCH_DECLARE(uint32_t) switch_core_media_bug_patch_video(switch_core_session_t *orig_session, switch_frame_t *frame)
+{
+ switch_media_bug_t *bp;
+ uint32_t x = 0, ok = SWITCH_TRUE, prune = 0;
+
+ if (orig_session->bugs) {
+ switch_thread_rwlock_rdlock(orig_session->bug_rwlock);
+ for (bp = orig_session->bugs; bp; bp = bp->next) {
+ if (!switch_test_flag(bp, SMBF_PRUNE) && !switch_test_flag(bp, SMBF_LOCK) && !strcmp(bp->function, "patch:video")) {
+ if (bp->ready && frame->img && switch_test_flag(bp, SMBF_VIDEO_PATCH)) {
+ bp->ping_frame = frame;
+ if (bp->callback) {
+ if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_VIDEO_PATCH) == SWITCH_FALSE
+ || (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL))) {
+ ok = SWITCH_FALSE;
+ }
+ }
+ bp->ping_frame = NULL;
+ }
+
+ if (ok == SWITCH_FALSE) {
+ switch_set_flag(bp, SMBF_PRUNE);
+ prune++;
+ } else x++;
+ }
+ }
+ switch_thread_rwlock_unlock(orig_session->bug_rwlock);
+ if (prune) {
+ switch_core_media_bug_prune(orig_session);
+ }
+ }
+
+ return x;
+}
+
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session,
const char *function, switch_media_bug_exec_cb_t cb, void *user_data)
{