Added version check for dynamic OpenH264 use.

This commit is contained in:
Armin Novak 2019-01-15 09:49:48 +01:00
parent 1c855068a2
commit 8c41bd21ea
2 changed files with 22 additions and 4 deletions

View File

@ -60,6 +60,7 @@
#cmakedefine WITH_SOXR
#cmakedefine WITH_GFX_H264
#cmakedefine WITH_OPENH264
#cmakedefine WITH_OPENH264_LOADING
#cmakedefine WITH_FFMPEG
#cmakedefine WITH_DSP_EXPERIMENTAL
#cmakedefine WITH_DSP_FFMPEG

View File

@ -18,6 +18,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <freerdp/log.h>
#include <freerdp/codec/h264.h>
#include <winpr/library.h>
@ -38,6 +42,7 @@ struct _H264_CONTEXT_OPENH264
{
#if defined (WITH_OPENH264_LOADING)
HMODULE lib;
OpenH264Version version;
#endif
pWelsGetCodecVersionEx WelsGetCodecVersionEx;
pWelsCreateDecoder WelsCreateDecoder;
@ -360,7 +365,6 @@ static void openh264_uninit(H264_CONTEXT* h264)
#if defined (WITH_OPENH264_LOADING)
static BOOL openh264_load_functionpointers(H264_CONTEXT* h264, const char* name)
{
OpenH264Version version;
H264_CONTEXT_OPENH264* sysContexts;
if (!h264)
@ -391,9 +395,22 @@ static BOOL openh264_load_functionpointers(H264_CONTEXT* h264, const char* name)
return FALSE;
}
sysContexts->WelsGetCodecVersionEx(&version);
WLog_Print(h264->log, WLOG_INFO, "loaded %s %d.%d.%d", name, version.uMajor, version.uMinor,
version.uRevision);
sysContexts->WelsGetCodecVersionEx(&sysContexts->version);
WLog_Print(h264->log, WLOG_INFO, "loaded %s %d.%d.%d", name, sysContexts->version.uMajor,
sysContexts->version.uMinor,
sysContexts->version.uRevision);
if ((sysContexts->version.uMajor < 1) || (sysContexts->version.uMinor < 6))
{
WLog_Print(h264->log, WLOG_ERROR,
"OpenH264 %s %d.%d.%d is too old, need at least version 1.6.0 for dynamic loading",
name, sysContexts->version.uMajor, sysContexts->version.uMinor,
sysContexts->version.uRevision);
FreeLibrary(sysContexts->lib);
sysContexts->lib = NULL;
return FALSE;
}
return TRUE;
}
#endif