uint8_t decoder_init;
switch_buffer_t *vpx_packet_buffer;
int got_key_frame;
+ int no_key_frame;
int got_start_frame;
uint32_t last_received_timestamp;
switch_bool_t last_received_complete_picture;
context->last_received_complete_picture = 0;
context->decoder_init = 1;
context->got_key_frame = 0;
+ context->no_key_frame = 0;
context->got_start_frame = 0;
// the types of post processing to be done, should be combination of "vp8_postproc_level"
ppcfg.post_proc_flag = VP8_DEBLOCK;//VP8_DEMACROBLOCK | VP8_DEBLOCK;
is_start = (*(unsigned char *)frame->data & 0x10);
is_keyframe = IS_VP8_KEY_FRAME((uint8_t *)frame->data);
}
-
+
+
+ if (context->got_key_frame <= 0) {
+ context->no_key_frame++;
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no keyframe, %d\n", context->no_key_frame);
+ if (context->no_key_frame > 50) {
+ if ((is_keyframe = is_start)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no keyframe, treating start as key.\n");
+ }
+ }
+ }
+
// if (is_keyframe) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "got key %d\n", is_keyframe);
if (context->need_decoder_reset != 0) {
if (is_keyframe) {
if (context->got_key_frame <= 0) {
context->got_key_frame = 1;
- if (!is_keyframe) {
- get_refresh = 1;
- }
+ context->no_key_frame = 0;
} else {
context->got_key_frame++;
}
if ((--context->got_key_frame % 200) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Waiting for key frame %d\n", context->got_key_frame);
}
+
+ get_refresh = 1;
+
if (!context->got_start_frame) {
switch_goto_status(SWITCH_STATUS_MORE_DATA, end);
}
if (switch_channel_test_flag(smh->session->channel, CF_REINVITE)) {
+ if (v_engine->remote_ssrc) {
+ switch_rtp_set_remote_ssrc(v_engine->rtp_session, v_engine->remote_ssrc);
+ }
+
if (switch_rtp_ready(engine->rtp_session) && engine->ice_in.cands[engine->ice_in.chosen[0]][0].ready && engine->new_ice) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "RE-Activating %s ICE\n", type2str(type));
rtcp_bytes = sbytes;
}
#endif
-//#define DEBUG_EXTRA
+ //#define DEBUG_EXTRA
#ifdef DEBUG_EXTRA
{
const char *old_host;
rtp_session->max_missed_packets = max;
}
+SWITCH_DECLARE(void) switch_rtp_reset_vb(switch_rtp_t *rtp_session)
+{
+ if (rtp_session->vb) {
+ switch_jb_reset(rtp_session->vb);
+ }
+
+ if (rtp_session->vbw) {
+ switch_jb_reset(rtp_session->vbw);
+ }
+}
+
SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session)
{
if (!rtp_session) {
rtcp_stats_init(rtp_session);
if (rtp_session->ice.ready) {
- if (rtp_session->vb) {
- switch_jb_reset(rtp_session->vb);
- }
- if (rtp_session->vbw) {
- switch_jb_reset(rtp_session->vbw);
- }
+ switch_rtp_reset_vb(rtp_session);
rtp_session->ice.ready = rtp_session->ice.rready = 0;
}