From 828b6a553e385d075a1e39a3a97c3bf9e19bcdfb Mon Sep 17 00:00:00 2001
From: Seven Du <dujinfang@gmail.com>
Date: Tue, 7 Apr 2015 11:03:39 +0800
Subject: [PATCH] FS-7508: improve vpx err msg

---
 src/mod/codecs/mod_vpx/mod_vpx.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mod/codecs/mod_vpx/mod_vpx.c b/src/mod/codecs/mod_vpx/mod_vpx.c
index 85d8efd8e9..e14f3db4e1 100644
--- a/src/mod/codecs/mod_vpx/mod_vpx.c
+++ b/src/mod/codecs/mod_vpx/mod_vpx.c
@@ -596,6 +596,7 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
 	int64_t pts;
 	vpx_enc_frame_flags_t vpx_flags = 0;
 	switch_time_t now;
+	int err;
 
 	if (frame->flags & SFF_SAME_IMAGE) {
 		return consume_partition(context, frame);
@@ -652,13 +653,14 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
 
 	dur = context->last_ms ? (now - context->last_ms) / 1000 : pts;
 
-	if (vpx_codec_encode(&context->encoder,
+	if ((err = vpx_codec_encode(&context->encoder,
 						 (vpx_image_t *) frame->img,
 						 pts,
 						 dur, 
 						 vpx_flags,
-						 VPX_DL_REALTIME) != VPX_CODEC_OK) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VPX encode error %d:%s\n", context->encoder.err, context->encoder.err_detail);
+						 VPX_DL_REALTIME)) != VPX_CODEC_OK) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VPX encode error %d:%s:%s\n",
+			err, vpx_codec_error(&context->encoder), vpx_codec_error_detail(&context->encoder));
 		frame->datalen = 0;
 		return SWITCH_STATUS_FALSE;
 	}