]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10282: mod_opus: fix some logging for debug mode (when opus_debug is on)
authorDragos Oancea <dragos.oancea@nexmo.com>
Tue, 2 May 2017 16:55:23 +0000 (17:55 +0100)
committerDragos Oancea <dragos.oancea@nexmo.com>
Tue, 2 May 2017 16:55:23 +0000 (17:55 +0100)
src/mod/codecs/mod_opus/mod_opus.c

index 279d7131691be187a4eb13df3ccd921f0ce5f78d..07699cc50d937e750bdba4a0181e2f7b9c78b408 100644 (file)
@@ -471,6 +471,8 @@ static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint3
        uint8_t * payload = encoded_data;
 
        if (!encoded_data) {
+               /* print stuff, even if encoded_data is NULL. eg: "PLC correction" */
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s", print_text);
                return SWITCH_STATUS_FALSE;
        }
 
@@ -721,8 +723,14 @@ static switch_status_t switch_opus_destroy(switch_codec_t *codec)
                                        avg_encoded_bitrate = (context->encoder_stats.encoded_bytes * 8) / (context->encoder_stats.encoded_msec / 1000);
                                }
 
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Opus encoder stats: Frames[%d] Bytes encoded[%d] Encoded length ms[%d] Average encoded bitrate bps[%d] FEC frames (only for debug mode) [%d]\n",
-                                                                               context->encoder_stats.frame_counter, context->encoder_stats.encoded_bytes, context->encoder_stats.encoded_msec, avg_encoded_bitrate, context->encoder_stats.fec_counter);
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                               "Opus encoder stats: Frames[%d] Bytes encoded[%d] Encoded length ms[%d] Average encoded bitrate bps[%d]\n",
+                                               context->encoder_stats.frame_counter, context->encoder_stats.encoded_bytes, context->encoder_stats.encoded_msec, avg_encoded_bitrate);
+
+                               if (globals.debug || context->debug > 1) {
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+                                                       "Opus encoder stats: FEC frames (only for debug mode) [%d]\n", context->encoder_stats.fec_counter);
+                               }
                        }
                        opus_encoder_destroy(context->encoder_object);
                        context->encoder_object = NULL;