Feature/rdkemw 17882#551
Conversation
) Summary: Fix reattaching audio source at dynamic audio codec change. Type: Fix Test Plan: UT/CT, Fullstack Jira: RDKEMW-17771 --------- Co-authored-by: smudri85 <smudri85@gmail.com> Co-authored-by: Marcin Wojciechowski <marcin.wojciechowski@sky.uk> Co-authored-by: Sasa Mudri <Sasa_Mudri@comcast.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Pull request must be merged with a description containing the required fields, Summary: If there is no jira releated to this change, please put 'Jira: NO-JIRA'. Description can be changed by editing the top comment on your pull request and making a new commit. |
There was a problem hiding this comment.
Pull request overview
Adds end-to-end audio first-frame notification support to gstplayer by detecting first-audio-frame signals (with an audio-sink fallback probe) and reusing the existing first-frame propagation path (MediaSourceType::AUDIO) without introducing a new public callback or protobuf event.
Changes:
- Wire audio first-frame detection in gstplayer element setup (signal-based + sink-pad probe fallback) and schedule first-frame handling with
MediaSourceType::AUDIO. - Refactor capability/property inspection to use element GType +
g_type_class_ref/unref, and introduce GLib thread-pool tuning/cleanup hooks. - Expand unit/component tests and add openspec change documentation for the new audio first-frame behavior.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| wrappers/interface/IGstWrapper.h | Adds wrapper API for gst_element_factory_get_element_type. |
| wrappers/interface/IGlibWrapper.h | Adds wrapper APIs for g_type_class_unref and GLib thread-pool controls. |
| wrappers/include/GstWrapper.h | Implements gstElementFactoryGetElementType. |
| wrappers/include/GlibWrapper.h | Implements gTypeClassUnref and thread-pool wrapper calls. |
| tests/unittests/media/server/mocks/gstplayer/GstGenericPlayerPrivateMock.h | Extends private-player mock with audio first-frame/probe lifecycle hooks. |
| tests/unittests/media/server/main/main.cpp | Adds Glib wrapper factory/mock wiring + expectations for thread-pool tuning in initialiser. |
| tests/unittests/media/server/gstplayer/main.cpp | Same as above for gstplayer unit-test main. |
| tests/unittests/media/server/gstplayer/genericPlayer/tasksTests/SetupElementTest.cpp | Adds unit test for first-audio-frame hookup and callback triggering. |
| tests/unittests/media/server/gstplayer/genericPlayer/tasksTests/FirstFrameReceivedTest.cpp | Adds unit coverage for notifying first frame received for AUDIO source type. |
| tests/unittests/media/server/gstplayer/genericPlayer/GstGenericPlayerPrivateTest.cpp | Adds unit coverage for scheduling first-audio-frame task. |
| tests/unittests/media/server/gstplayer/genericPlayer/GstCapabilitiesTest.cpp | Updates tests for GType-based property inspection + adds invalid-type scenario. |
| tests/unittests/media/server/gstplayer/genericPlayer/CreateTest.cpp | Expects GLib stop-unused-threads on teardown. |
| tests/unittests/media/server/gstplayer/genericPlayer/common/GstGenericPlayerTestCommon.cpp | Adds gTypeClassUnref expectations and stop-unused-threads expectation on destroy. |
| tests/unittests/media/server/gstplayer/genericPlayer/common/GenericTasksTestsContext.h | Stores first-audio-frame callback in test context. |
| tests/unittests/media/server/gstplayer/genericPlayer/common/GenericTasksTestsBase.h | Adds helper declarations for audio first-frame signal hookup and triggering. |
| tests/unittests/media/server/gstplayer/genericPlayer/common/GenericTasksTestsBase.cpp | Implements audio first-frame signal expectations + trigger helpers; updates stop expectations. |
| tests/componenttests/server/tests/mediaPipelineCapabilities/MediaPipelineCapabilitiesTest.cpp | Updates to GType-based property inspection expectations. |
| tests/componenttests/server/tests/mediaPipeline/FirstFrameNotificationTest.cpp | Adds server component test covering audio first-frame notification flow. |
| tests/componenttests/server/tests/mediaPipeline/DualVideoPlaybackTest.cpp | Adds gTypeClassUnref expectations and stop-unused-threads expectations. |
| tests/componenttests/server/fixtures/RialtoServerComponentTest.cpp | Adds GLib thread-pool tuning expectations during gst initialisation. |
| tests/componenttests/server/fixtures/MediaPipelineTest.cpp | Adds gTypeClassUnref and stop-unused-threads expectations around create/destroy. |
| tests/componenttests/client/tests/mse/FirstFrameNotificationTest.cpp | Updates client component test doc + adds audio first-frame notification steps. |
| tests/componenttests/client/tests/base/MediaPipelineTestMethods.h | Adds client test helper declarations for audio first-frame received. |
| tests/componenttests/client/tests/base/MediaPipelineTestMethods.cpp | Implements client test helpers to send/expect audio first-frame received. |
| tests/common/externalLibraryMocks/GstWrapperMock.h | Adds mock for gstElementFactoryGetElementType. |
| tests/common/externalLibraryMocks/GlibWrapperMock.h | Adds mocks for gTypeClassUnref and GLib thread-pool methods. |
| openspec/changes/audio-first-frame/tasks.md | Adds implementation checklist for the change. |
| openspec/changes/audio-first-frame/specs/audio-first-frame/spec.md | Defines requirements/scenarios for audio first-frame detection and one-shot behavior. |
| openspec/changes/audio-first-frame/proposal.md | Describes motivation and high-level approach. |
| openspec/changes/audio-first-frame/design.md | Documents design decisions, trade-offs, and risks. |
| openspec/changes/audio-first-frame/.openspec.yaml | Adds openspec metadata for the change. |
| media/server/gstplayer/source/Utils.cpp | Extends first-frame signal lookup list to include audio signals. |
| media/server/gstplayer/source/tasks/generic/SynchroniseSubtitleClock.cpp | Fixes leak by freeing structure when event creation fails. |
| media/server/gstplayer/source/tasks/generic/Stop.cpp | Resets audio first-frame guard + clears fallback probe on stop. |
| media/server/gstplayer/source/tasks/generic/SetupElement.cpp | Adds audio first-frame signal callback + sink-pad probe fallback installation. |
| media/server/gstplayer/source/tasks/generic/AttachSource.cpp | Resets audio first-frame guard on (re)attach of audio source. |
| media/server/gstplayer/source/tasks/generic/AttachSamples.cpp | Unrefs GstBuffer on segment cast failures to avoid leaks. |
| media/server/gstplayer/source/GstInitialiser.cpp | Applies GLib thread-pool tuning during gst initialisation via wrapper. |
| media/server/gstplayer/source/GstGenericPlayer.cpp | Adds audio first-frame scheduling/guard + fallback probe state lifecycle; adds thread-pool cleanup + malloc_trim. |
| media/server/gstplayer/source/GstCapabilities.cpp | Switches supported-properties inspection to GType class ref/unref approach. |
| media/server/gstplayer/include/IGstGenericPlayerPrivate.h | Adds audio first-frame scheduling + probe lifecycle API. |
| media/server/gstplayer/include/GstGenericPlayer.h | Implements new private interface methods in player class. |
| media/server/gstplayer/include/GenericPlayerContext.h | Adds audio first-frame one-shot flag + stored fallback probe pad/id. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| void GenericTasksTestsBase::shouldSetVideoUnderflowCallback() | ||
| { | ||
| ASSERT_TRUE(testContext->m_videoUnderflowCallback); | ||
| EXPECT_CALL(testContext->m_gstPlayer, scheduleVideoUnderflow()); | ||
| } |
| void GstGenericPlayer::scheduleFirstAudioFrameReceived() | ||
| { | ||
| if (m_context.firstAudioFrameReceived || !m_workerThread) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| m_context.firstAudioFrameReceived = true; | ||
| m_workerThread->enqueueTask(m_taskFactory->createFirstFrameReceived(m_context, *this, MediaSourceType::AUDIO)); | ||
| } |
| #include <cinttypes> | ||
| #include <cstring> | ||
| #include <ctime> | ||
| #include <malloc.h> |
| m_glibWrapper->gThreadPoolStopUnusedThreads(); | ||
| malloc_trim(0); |
| m_glibWrapper->gSignalConnect(m_element, firstFrameSignalName.value().c_str(), | ||
| G_CALLBACK(firstVideoFrameCallback), &m_player); | ||
| } | ||
| else if (isAudio(*m_gstWrapper, m_element)) | ||
| { |
Audio first frame