int layers_used;
int layout_floor_id;
int refresh;
- int reset_video;
+ int send_keyframe;
int play_file;
switch_rgb_color_t bgcolor;
switch_mutex_t *mutex;
conference->canvas->layers_used = 0;
conference->canvas->total_layers = vlayout->layers;
+ conference->canvas->send_keyframe = 1;
switch_mutex_unlock(conference->canvas->mutex);
}
}
switch_core_timer_init(&conference->canvas->timer, "soft", conference->video_fps.ms, conference->video_fps.samples, NULL);
- conference->canvas->reset_video = 1;
+ conference->canvas->send_keyframe = 1;
}
if (!conference->playing_video_file) {
conference->canvas->refresh = 0;
}
- if (conference->canvas->reset_video) {
- //need_refresh = SWITCH_TRUE;
- //need_reset = SWITCH_TRUE;
+ if (conference->canvas->send_keyframe) {
need_keyframe = SWITCH_TRUE;
- conference->canvas->reset_video = 0;
+ conference->canvas->send_keyframe = 0;
}
if (video_key_freq && (now - last_key_time) > video_key_freq) {
switch_img_free(&file_img);
if (conference->canvas->play_file) {
- conference->canvas->reset_video = 1;
+ conference->canvas->send_keyframe = 1;
conference->canvas->play_file = 0;
conference->canvas->timer.interval = 1;
conference->canvas->timer.interval = conference->video_fps.ms;
conference->canvas->timer.samples = conference->video_fps.samples;
switch_core_timer_sync(&conference->canvas->timer);
- conference->canvas->reset_video = 1;
+ conference->canvas->send_keyframe = 1;
conference->playing_video_file = 0;
}
return switch_core_file_close(&node->fh);
goto end;
}
+ if (conference->canvas) {
+ conference->canvas->send_keyframe = 1;
+ }
+
fh.pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT;
switch_core_timer_destroy(&timer);
conference_del_member(conference, member);
+ if (conference->canvas) {
+ conference->canvas->send_keyframe = 1;
+ }
+
switch_buffer_destroy(&member->audio_buffer);
switch_buffer_destroy(&member->mux_buffer);
switch_clear_flag_locked(member, MFLAG_RUNNING);
flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT;
if (conference->members_with_video && switch_test_flag(conference, CFLAG_TRANSCODE_VIDEO)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Vido FLAG\n");
flags |= SWITCH_FILE_FLAG_VIDEO;
}
static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
switch_call_cause_t cause;
+ char *tmp;
switch_assert(stream != NULL);
return SWITCH_STATUS_GENERR;
}
+ if (conference && argv[2] && strstr(argv[2], "vlc/")) {
+ tmp = switch_core_sprintf(conference->pool, "{vlc_rate=%d,vlc_channels=%d,vlc_interval=%d}%s",
+ conference->rate, conference->channels, conference->interval, argv[2]);
+ argv[2] = tmp;
+ }
+
if (conference) {
conference_outcall(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], NULL, &cause, NULL, NULL);
} else {
switch_codec_t video_codec;
switch_frame_t read_frame;
switch_frame_t read_video_frame;
- void *audio_data[SWITCH_RECOMMENDED_BUFFER_SIZE];
- void *video_data[SWITCH_RECOMMENDED_BUFFER_SIZE * 20];
+ unsigned char *audio_data;
+ switch_size_t audio_datalen;
const char *destination_number;
vlc_video_context_t *context;
switch_timer_t timer;
memset(tech_pvt, 0, sizeof(*tech_pvt));
+ tech_pvt->audio_datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
+ tech_pvt->audio_data = switch_core_session_alloc(session, tech_pvt->audio_datalen);
+
if (osession) {
switch_core_session_get_read_impl(osession, &tech_pvt->read_impl);
} else {
const char *val;
int tmp = 0;
+ int packets;
+
- tech_pvt->read_impl.microseconds_per_packet = 20000;
+ val = switch_event_get_header(var_event, "vlc_interval");
+ if (val) tmp = atoi(val);
+ if (tmp == 0) tmp = 20;
+ tech_pvt->read_impl.microseconds_per_packet = tmp * 1000;
+
tech_pvt->read_impl.iananame = "L16";
+ tmp = 0;
val = switch_event_get_header(var_event, "vlc_rate");
if (val) tmp = atoi(val);
if (tmp == 0) tmp = 8000;
+
+ packets = 1000 / (tech_pvt->read_impl.microseconds_per_packet / 1000);
+
tech_pvt->read_impl.samples_per_second = tmp;
tech_pvt->read_impl.actual_samples_per_second = tmp;
- tech_pvt->read_impl.samples_per_packet = tech_pvt->read_impl.samples_per_second / (tech_pvt->read_impl.microseconds_per_packet / 1000);
+ tech_pvt->read_impl.samples_per_packet = tech_pvt->read_impl.samples_per_second / packets;
tmp = 0;
val = switch_event_get_header(var_event, "vlc_channels");
}
tech_pvt->read_impl.number_of_channels = tmp;
tech_pvt->read_impl.decoded_bytes_per_packet = tech_pvt->read_impl.samples_per_packet * 2 * tech_pvt->read_impl.number_of_channels;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No BLAH %d %d\n", tech_pvt->read_impl.samples_per_second, tech_pvt->read_impl.number_of_channels);
+
}
tech_pvt->session = session;
return SWITCH_STATUS_SUCCESS;
}
- switch_mutex_lock(context->audio_mutex);
+ *frame = &tech_pvt->read_frame;
+ tech_pvt->read_frame.codec = &tech_pvt->read_codec;
+ tech_pvt->read_frame.data = tech_pvt->audio_data;
+ tech_pvt->read_frame.datalen = audio_datalen;
+ tech_pvt->read_frame.buflen = tech_pvt->audio_datalen;
+ switch_mutex_lock(context->audio_mutex);
if (switch_buffer_inuse(context->audio_buffer) >= audio_datalen) {
- tech_pvt->read_frame.data = tech_pvt->audio_data;
- switch_buffer_read(context->audio_buffer, tech_pvt->read_frame.data, audio_datalen);
- tech_pvt->read_frame.datalen = audio_datalen;
- tech_pvt->read_frame.buflen = audio_datalen;
- tech_pvt->read_frame.flags &= ~SFF_CNG;
- tech_pvt->read_frame.codec = &tech_pvt->read_codec;
- *frame = &tech_pvt->read_frame;
- switch_mutex_unlock(context->audio_mutex);
- return SWITCH_STATUS_SUCCESS;
+ switch_buffer_read(context->audio_buffer, tech_pvt->audio_data, audio_datalen);
+ } else {
+ memset(tech_pvt->audio_data, 0, audio_datalen);
}
-
switch_mutex_unlock(context->audio_mutex);
- *frame = &tech_pvt->read_frame;
- tech_pvt->read_frame.codec = &tech_pvt->read_codec;
- tech_pvt->read_frame.flags |= SFF_CNG;
- tech_pvt->read_frame.datalen = 0;
-
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read cng frame\n");
return SWITCH_STATUS_SUCCESS;
}
if (!codec->implementation || !switch_core_codec_ready(codec)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initialized!\n");
+ abort();
return SWITCH_STATUS_NOT_INITALIZED;
}
codec = &engine->write_codec;
}
+ if (!switch_core_codec_ready(codec)) {
+ return SWITCH_STATUS_FALSE;
+ }
+
if (mtype == SWITCH_MEDIA_TYPE_VIDEO) {
if (!switch_channel_test_flag(session->channel, CF_VIDEO)) {
return SWITCH_STATUS_FALSE;