]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7508: tolerate some messed up packets a little more
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 20 Nov 2014 03:25:18 +0000 (21:25 -0600)
committerMichael Jerris <mike@jerris.com>
Thu, 28 May 2015 17:46:45 +0000 (12:46 -0500)
src/include/switch_types.h
src/mod/codecs/mod_vpx/mod_vpx.c
src/switch_core_media.c

index bc544a342674c43e7d906eff0f9c219e0402ecaa..4c3a0b9b821f314704eec7baad822960ddd34750 100644 (file)
@@ -226,7 +226,7 @@ SWITCH_BEGIN_EXTERN_C
 #define SWITCH_DTMF_LOG_LEN 1000
 #define SWITCH_MAX_TRANS 2000
 #define SWITCH_CORE_SESSION_MAX_PRIVATES 2
-#define SWITCH_DEFAULT_VIDEO_SIZE 1500
+#define SWITCH_DEFAULT_VIDEO_SIZE 1200
 
 /* Jitter */
 #define JITTER_VARIANCE_THRESHOLD 400.0
index 08c9b5bb03d2ae405df64acda7e0cebff2b5307d..066c23ed787f55456b09c3b366ef5da57bb6c34a 100644 (file)
@@ -514,7 +514,7 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
                (!frame->m) && (!context->last_received_complete_picture)) {
                // possible packet loss
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Packet Loss, skip previous received frame (to avoid crash?)\n");
-               switch_goto_status(SWITCH_STATUS_RESTART, end);
+               switch_goto_status(SWITCH_STATUS_NOTFOUND, end);
        }
 
        context->last_received_timestamp = frame->timestamp;
@@ -549,7 +549,7 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
 
                if (err != VPX_CODEC_OK) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error decoding %" SWITCH_SIZE_T_FMT " bytes, [%d:%d:%s]\n", len, err, decoder->err, decoder->err_detail);
-                       switch_goto_status(SWITCH_STATUS_RESTART, end);
+                       switch_goto_status(SWITCH_STATUS_NOTFOUND, end);
                }
 
                if (vpx_codec_control(decoder, VP8D_GET_FRAME_CORRUPTED, &corrupted) != VPX_CODEC_OK) {
@@ -560,8 +560,8 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
                frame->img = (switch_image_t *) vpx_codec_get_frame(decoder, &iter);
 
                if (!(frame->img) || corrupted) {
-                       switch_buffer_zero(context->vpx_packet_buffer);
-                       switch_goto_status(SWITCH_STATUS_SUCCESS, end);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "VPX invalid packet\n");
+                       switch_goto_status(SWITCH_STATUS_NOTFOUND, end);
                }
 
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "IMAGE %dx%d %dx%d\n", frame->img->w,frame->img->h, frame->img->d_w, frame->img->d_h);
@@ -571,6 +571,11 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
 
 end:
 
+       if (status == SWITCH_STATUS_NOTFOUND) {
+               switch_buffer_zero(context->vpx_packet_buffer);
+               switch_set_flag(frame, SFF_WAIT_KEY_FRAME);
+       }
+
        if (status == SWITCH_STATUS_RESTART) {
                context->got_key_frame = 0;
                switch_buffer_zero(context->vpx_packet_buffer);
index 47ee39b12b6ee3d441c44b6d3a1528a021184d15..f3c4270c4a9fcc1db9d4561053c07ae2ea4a9308 100644 (file)
@@ -9714,7 +9714,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
                                                ok = SWITCH_FALSE;
                                        }
                                }
-                               bp->ping_frame = NULL;;
+                               bp->ping_frame = NULL;
                                switch_mutex_unlock(bp->read_mutex);
                        }