rtmp: correct librtmp log-level mappings

Additionally, move to a switch in _set_debug_level()
to make easier to follow and compare with the
mappings in _log_callback()
This commit is contained in:
Reynaldo H. Verdejo Pinochet 2015-12-29 11:58:31 -08:00
parent 4e37976d83
commit 4b93a7167f

View file

@ -50,11 +50,17 @@ gst_rtmp_log_callback (int level, const gchar * fmt, va_list vl)
case RTMP_LOGWARNING: case RTMP_LOGWARNING:
gst_level = GST_LEVEL_WARNING; gst_level = GST_LEVEL_WARNING;
break; break;
case RTMP_LOGINFO:
gst_level = GST_LEVEL_INFO;
break;
case RTMP_LOGDEBUG: case RTMP_LOGDEBUG:
gst_level = GST_LEVEL_DEBUG; gst_level = GST_LEVEL_DEBUG;
break; break;
case RTMP_LOGDEBUG2:
gst_level = GST_LEVEL_LOG;
break;
default: default:
gst_level = GST_LEVEL_INFO; gst_level = GST_LEVEL_TRACE;
break; break;
} }
@ -68,14 +74,27 @@ _set_debug_level (void)
RTMP_LogSetCallback (gst_rtmp_log_callback); RTMP_LogSetCallback (gst_rtmp_log_callback);
gst_level = gst_debug_category_get_threshold (rtmp_debug); gst_level = gst_debug_category_get_threshold (rtmp_debug);
if (gst_level >= GST_LEVEL_LOG)
RTMP_LogSetLevel (RTMP_LOGALL); switch (gst_level) {
else if (gst_level >= GST_LEVEL_DEBUG) case GST_LEVEL_ERROR:
RTMP_LogSetLevel (RTMP_LOGDEBUG); RTMP_LogSetLevel (RTMP_LOGERROR);
else if (gst_level >= GST_LEVEL_INFO) break;
RTMP_LogSetLevel (RTMP_LOGINFO); case GST_LEVEL_WARNING:
else if (gst_level >= GST_LEVEL_WARNING) case GST_LEVEL_FIXME:
RTMP_LogSetLevel (RTMP_LOGWARNING); RTMP_LogSetLevel (RTMP_LOGWARNING);
break;
case GST_LEVEL_INFO:
RTMP_LogSetLevel (RTMP_LOGINFO);
break;
case GST_LEVEL_DEBUG:
RTMP_LogSetLevel (RTMP_LOGDEBUG);
break;
case GST_LEVEL_LOG:
RTMP_LogSetLevel (RTMP_LOGDEBUG2);
break;
default: /* _TRACE and beyond */
RTMP_LogSetLevel (RTMP_LOGALL);
}
} }
#endif #endif