Fix OpenH264 trace logging, set up context first
@@ -44,6 +44,7 @@ typedef struct _H264_CONTEXT_OPENH264 H264_CONTEXT_OPENH264;
static void openh264_trace_callback(H264_CONTEXT* h264, int level,
const char* message)
{
+ if (h264)
WLog_Print(h264->log, WLOG_TRACE, "%d - %s", level, message);
}
@@ -420,26 +421,26 @@ static BOOL openh264_init(H264_CONTEXT* h264)
}
status = (*sys->pDecoder)->SetOption(
- sys->pDecoder, DECODER_OPTION_TRACE_CALLBACK,
- &traceCallback);
+ sys->pDecoder,
+ DECODER_OPTION_TRACE_CALLBACK_CONTEXT,
+ &h264);
if (status != 0)
{
WLog_Print(h264->log, WLOG_ERROR,
- "Failed to set trace callback option on OpenH264 decoder (status=%ld)",
+ "Failed to set trace callback context option on OpenH264 decoder (status=%ld)",
status);
goto EXCEPTION;
}
status = (*sys->pDecoder)->SetOption(
- sys->pDecoder,
- DECODER_OPTION_TRACE_CALLBACK_CONTEXT,
- &h264);
+ sys->pDecoder, DECODER_OPTION_TRACE_CALLBACK,
+ &traceCallback);
if (status != 0)
{
WLog_Print(h264->log, WLOG_ERROR,
- "Failed to set trace callback context option on OpenH264 decoder (status=%ld)",
+ "Failed to set trace callback option on OpenH264 decoder (status=%ld)",
status);
goto EXCEPTION;
}
