libfreerdp-codec: fix OpenH264 usage thanks to @erbth's hack

This commit is contained in:
Marc-André Moreau 2014-07-28 17:22:02 -04:00
parent 6c034f17eb
commit 8321d7ffad
2 changed files with 14 additions and 2 deletions

View File

@ -167,7 +167,7 @@ static void h264_dump_h264_data(BYTE* data, int size)
fclose(fp);
}
static void h264_dump_yuv_data(BYTE* yuv[], int width, int height, int stride[])
void h264_dump_yuv_data(BYTE* yuv[], int width, int height, int stride[])
{
FILE* fp;
BYTE* srcp;
@ -326,7 +326,7 @@ BYTE* h264_strip_nal_unit_au_delimiter(BYTE* pSrcData, UINT32* pSrcSize)
#ifdef WITH_OPENH264
static BOOL g_openh264_trace_enabled = TRUE;
static BOOL g_openh264_trace_enabled = FALSE;
static void openh264_trace_callback(H264_CONTEXT* h264, int level, const char* message)
{
@ -361,6 +361,16 @@ static int openh264_decompress(H264_CONTEXT* h264, BYTE* pSrcData, UINT32 SrcSiz
pYUVData,
&sBufferInfo);
/**
* Calling DecodeFrame2 twice apparently works around Openh264 issue #1136:
* https://github.com/cisco/openh264/issues/1136
*
* This is a hack, but it works and it is only necessary for the first frame.
*/
if (sBufferInfo.iBufferStatus != 1)
state = (*h264->pDecoder)->DecodeFrame2(h264->pDecoder, NULL, 0, pYUVData, &sBufferInfo);
pSystemBuffer = &sBufferInfo.UsrData.sSystemBuffer;
#if 1

View File

@ -126,6 +126,7 @@ int WtsApi32_InitializeWtsApi(void)
if (!g_WtsApi32Module)
return -1;
#ifdef _WIN32
WTSAPI32_LOAD_PROC(StopRemoteControlSession, WTS_STOP_REMOTE_CONTROL_SESSION_FN);
WTSAPI32_LOAD_PROC(StartRemoteControlSessionW, WTS_START_REMOTE_CONTROL_SESSION_FN_W);
WTSAPI32_LOAD_PROC(StartRemoteControlSessionA, WTS_START_REMOTE_CONTROL_SESSION_FN_A);
@ -189,6 +190,7 @@ int WtsApi32_InitializeWtsApi(void)
WTSAPI32_LOAD_PROC(IsChildSessionsEnabled, WTS_IS_CHILD_SESSIONS_ENABLED_FN);
WTSAPI32_LOAD_PROC(GetChildSessionId, WTS_GET_CHILD_SESSION_ID_FN);
WTSAPI32_LOAD_PROC(GetActiveConsoleSessionId, WTS_GET_ACTIVE_CONSOLE_SESSION_ID_FN);
#endif
g_WtsApi = &WtsApi32_WtsApiFunctionTable;