diff --git a/GstUtils.cpp b/GstUtils.cpp index 38283377..366b6bc4 100644 --- a/GstUtils.cpp +++ b/GstUtils.cpp @@ -157,4 +157,3 @@ void PlayerCliGstTerm() { gst_deinit(); } - diff --git a/InterfacePlayerRDK.cpp b/InterfacePlayerRDK.cpp index dc5e6690..d937a772 100644 --- a/InterfacePlayerRDK.cpp +++ b/InterfacePlayerRDK.cpp @@ -5138,7 +5138,7 @@ void InterfacePlayerRDK::InitializePlayerGstreamerPlugins() if (!gst_init_check(nullptr, nullptr, nullptr)) { MW_LOG_ERR("gst_init_check() failed"); } - + SocUtils::Init(); #define PLUGINS_TO_LOWER_RANK_MAX 2 static const char *plugins_to_lower_rank[PLUGINS_TO_LOWER_RANK_MAX] = { "aacparse", diff --git a/SocUtils.cpp b/SocUtils.cpp index e6967a80..5449cb86 100644 --- a/SocUtils.cpp +++ b/SocUtils.cpp @@ -27,7 +27,16 @@ namespace SocUtils { - static std::shared_ptr socInterface = SocInterface::CreateSocInterface(); + static std::shared_ptr GetSocInterface() + { + static std::shared_ptr socInterface = SocInterface::CreateSocInterface(); + return socInterface; + } + + void Init() + { + (void)GetSocInterface(); + } /** * @brief Checks if AppSrc should be used for progressive playback. * @@ -38,7 +47,7 @@ namespace SocUtils */ bool UseAppSrcForProgressivePlayback( void ) { - return socInterface->UseAppSrc(); + return GetSocInterface()->UseAppSrc(); } /** @@ -51,7 +60,7 @@ namespace SocUtils */ bool UseWesterosSink( void ) { - return socInterface->UseWesterosSink(); + return GetSocInterface()->UseWesterosSink(); } /** @@ -63,7 +72,7 @@ namespace SocUtils */ bool IsAudioFragmentSyncSupported( void ) { - return socInterface->IsAudioFragmentSyncSupported(); + return GetSocInterface()->IsAudioFragmentSyncSupported(); } /** @@ -76,7 +85,7 @@ namespace SocUtils */ bool EnableLiveLatencyCorrection( void ) { - return socInterface->EnableLiveLatencyCorrection(); + return GetSocInterface()->EnableLiveLatencyCorrection(); } /** @@ -89,7 +98,7 @@ namespace SocUtils */ int RequiredQueuedFrames( void ) { - return socInterface->RequiredQueuedFrames(); + return GetSocInterface()->RequiredQueuedFrames(); } /** @@ -102,7 +111,7 @@ namespace SocUtils */ bool EnablePTSRestamp(void) { - return socInterface->EnablePTSRestamp(); + return GetSocInterface()->EnablePTSRestamp(); } /** * @brief Resets segment event flags during trickplay transitions. @@ -111,7 +120,7 @@ namespace SocUtils */ bool ResetNewSegmentEvent() { - return socInterface->ResetNewSegmentEvent(); + return GetSocInterface()->ResetNewSegmentEvent(); } /** * @brief Check if GST Subtec is enabled diff --git a/SocUtils.h b/SocUtils.h index 892eb3d4..d1aed318 100644 --- a/SocUtils.h +++ b/SocUtils.h @@ -26,6 +26,13 @@ namespace SocUtils { + /** + * @brief Initializes access to SOC-specific runtime capabilities. + * + * This function can be used to perform eager initialization during startup. + * SocUtils accessors also perform lazy initialization when needed. + */ + void Init(); /** * @brief Checks if AppSrc should be used for progressive playback. * diff --git a/test/utests/fakes/FakeSocUtils.cpp b/test/utests/fakes/FakeSocUtils.cpp index daf88972..afc302ee 100644 --- a/test/utests/fakes/FakeSocUtils.cpp +++ b/test/utests/fakes/FakeSocUtils.cpp @@ -21,6 +21,10 @@ namespace SocUtils { + void Init() + { + } + void InitializePlatformConfigs() { }