Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2026 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : */
19 :
20 : #include "tasks/generic/FirstFrameReceived.h"
21 : #include "RialtoServerLogging.h"
22 : #include "TypeConverters.h"
23 :
24 : namespace firebolt::rialto::server::tasks::generic
25 : {
26 4 : FirstFrameReceived::FirstFrameReceived(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
27 : IGstGenericPlayerClient *client, MediaSourceType sourceType,
28 4 : AudioFirstFrameAction audioAction)
29 4 : : m_context{context}, m_player{player}, m_gstPlayerClient{client}, m_sourceType{sourceType},
30 4 : m_audioAction{audioAction}
31 : {
32 4 : RIALTO_SERVER_LOG_DEBUG("Constructing FirstFrameReceived");
33 : }
34 :
35 5 : FirstFrameReceived::~FirstFrameReceived()
36 : {
37 4 : RIALTO_SERVER_LOG_DEBUG("FirstFrameReceived finished");
38 5 : }
39 :
40 3 : void FirstFrameReceived::execute() const
41 : {
42 3 : RIALTO_SERVER_LOG_DEBUG("Executing FirstFrameReceived for %s source", common::convertMediaSourceType(m_sourceType));
43 :
44 3 : if (m_sourceType == MediaSourceType::AUDIO)
45 : {
46 1 : if (m_audioAction == AudioFirstFrameAction::CLEAR_PROBE)
47 : {
48 1 : m_player.clearAudioFirstFrameFallbackProbe();
49 : }
50 0 : else if (m_audioAction == AudioFirstFrameAction::CLEAR_PROBE_STATE)
51 : {
52 0 : m_player.clearAudioFirstFrameFallbackProbeState();
53 : }
54 :
55 1 : if (m_context.audioSourceRemoved)
56 : {
57 0 : RIALTO_SERVER_LOG_DEBUG("Ignoring first audio frame notification - audio source removed");
58 0 : return;
59 : }
60 :
61 1 : if (m_context.firstAudioFrameReceived)
62 : {
63 0 : RIALTO_SERVER_LOG_DEBUG("First audio frame notification already sent");
64 0 : return;
65 : }
66 :
67 1 : m_context.firstAudioFrameReceived = true;
68 : }
69 :
70 3 : if (m_gstPlayerClient)
71 : {
72 2 : m_gstPlayerClient->notifyFirstFrameReceived(m_sourceType);
73 : }
74 : }
75 : } // namespace firebolt::rialto::server::tasks::generic
|