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 "MediaPipelineMetricsClient.h"
21 :
22 : namespace firebolt::rialto::server::service
23 : {
24 88 : MediaPipelineMetricsClient::MediaPipelineMetricsClient(int sessionId, const std::shared_ptr<IMediaPipelineClient> &client,
25 88 : IPrivateMetricsService &metricsService)
26 88 : : m_sessionId{sessionId}, m_client{client}, m_metricsService{metricsService}
27 : {
28 : }
29 :
30 1 : void MediaPipelineMetricsClient::notifyDuration(int64_t duration)
31 : {
32 1 : m_client->notifyDuration(duration);
33 : }
34 1 : void MediaPipelineMetricsClient::notifyPosition(int64_t position)
35 : {
36 1 : m_client->notifyPosition(position);
37 : }
38 1 : void MediaPipelineMetricsClient::notifyNativeSize(uint32_t width, uint32_t height, double aspect)
39 : {
40 1 : m_client->notifyNativeSize(width, height, aspect);
41 : }
42 1 : void MediaPipelineMetricsClient::notifyNetworkState(NetworkState state)
43 : {
44 1 : m_client->notifyNetworkState(state);
45 : }
46 2 : void MediaPipelineMetricsClient::notifyPlaybackState(PlaybackState state)
47 : {
48 2 : m_metricsService.notifyPlaybackStateChanged(m_sessionId, m_currentPlaybackState, state);
49 2 : m_currentPlaybackState = state;
50 2 : m_client->notifyPlaybackState(state);
51 : }
52 1 : void MediaPipelineMetricsClient::notifyVideoData(bool hasData)
53 : {
54 1 : m_client->notifyVideoData(hasData);
55 : }
56 1 : void MediaPipelineMetricsClient::notifyAudioData(bool hasData)
57 : {
58 1 : m_client->notifyAudioData(hasData);
59 : }
60 1 : void MediaPipelineMetricsClient::notifyNeedMediaData(int32_t sourceId, size_t frameCount, uint32_t needDataRequestId,
61 : const std::shared_ptr<MediaPlayerShmInfo> &shmInfo)
62 : {
63 1 : m_client->notifyNeedMediaData(sourceId, frameCount, needDataRequestId, shmInfo);
64 : }
65 1 : void MediaPipelineMetricsClient::notifyCancelNeedMediaData(int32_t sourceId)
66 : {
67 1 : m_client->notifyCancelNeedMediaData(sourceId);
68 : }
69 1 : void MediaPipelineMetricsClient::notifyQos(int32_t sourceId, const QosInfo &qosInfo)
70 : {
71 1 : m_client->notifyQos(sourceId, qosInfo);
72 : }
73 1 : void MediaPipelineMetricsClient::notifyBufferUnderflow(int32_t sourceId)
74 : {
75 1 : m_client->notifyBufferUnderflow(sourceId);
76 : }
77 1 : void MediaPipelineMetricsClient::notifyFirstFrameReceived(int32_t sourceId)
78 : {
79 1 : m_client->notifyFirstFrameReceived(sourceId);
80 : }
81 1 : void MediaPipelineMetricsClient::notifyPlaybackError(int32_t sourceId, PlaybackError error)
82 : {
83 1 : m_client->notifyPlaybackError(sourceId, error);
84 : }
85 1 : void MediaPipelineMetricsClient::notifySourceFlushed(int32_t sourceId)
86 : {
87 1 : m_client->notifySourceFlushed(sourceId);
88 : }
89 1 : void MediaPipelineMetricsClient::notifyPlaybackInfo(const PlaybackInfo &playbackInfo)
90 : {
91 1 : m_client->notifyPlaybackInfo(playbackInfo);
92 : }
93 : } // namespace firebolt::rialto::server::service
|