LCOV - code coverage report
Current view: top level - media/server/gstplayer/source/tasks/generic - UpdatePlaybackGroup.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 43 43
Test Date: 2026-07-31 13:30:47 Functions: 100.0 % 3 3

            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 2023 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/UpdatePlaybackGroup.h"
      21              : #include "RialtoServerLogging.h"
      22              : 
      23              : namespace firebolt::rialto::server::tasks::generic
      24              : {
      25           10 : UpdatePlaybackGroup::UpdatePlaybackGroup(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
      26              :                                          const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
      27              :                                          const std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> &glibWrapper,
      28           10 :                                          GstElement *typefind, GstCaps *caps)
      29           10 :     : m_context{context}, m_player{player}, m_gstWrapper{gstWrapper}, m_glibWrapper{glibWrapper}, m_typefind{typefind},
      30           10 :       m_caps{caps}
      31              : {
      32           10 :     RIALTO_SERVER_LOG_DEBUG("Constructing UpdatePlaybackGroup");
      33              : }
      34              : 
      35           11 : UpdatePlaybackGroup::~UpdatePlaybackGroup()
      36              : {
      37           10 :     RIALTO_SERVER_LOG_DEBUG("UpdatePlaybackGroup finished");
      38           10 :     m_gstWrapper->gstObjectUnref(m_typefind);
      39           10 :     if (m_caps)
      40              :     {
      41            8 :         m_gstWrapper->gstCapsUnref(m_caps);
      42              :     }
      43           11 : }
      44              : 
      45            9 : void UpdatePlaybackGroup::execute() const
      46              : {
      47            9 :     RIALTO_SERVER_LOG_DEBUG("Executing UpdatePlaybackGroup");
      48            9 :     if (nullptr == m_caps)
      49              :     {
      50            1 :         RIALTO_SERVER_LOG_DEBUG("Typefind SRC Pad Caps NULL");
      51            1 :         return;
      52              :     }
      53            8 :     gchar *typefindCaps = m_gstWrapper->gstCapsToString(m_caps);
      54            8 :     if (typefindCaps)
      55              :     {
      56            7 :         RIALTO_SERVER_LOG_DEBUG("Typefind SRC Pad Strm Parsed Caps %s", typefindCaps);
      57            7 :         if (m_glibWrapper->gStrrstr(typefindCaps, "audio/"))
      58              :         {
      59            6 :             GstElement *typeFindParent = reinterpret_cast<GstElement *>(m_gstWrapper->gstElementGetParent(m_typefind));
      60            6 :             if (typeFindParent)
      61              :             {
      62            5 :                 gchar *elementName = m_gstWrapper->gstElementGetName(typeFindParent);
      63            5 :                 RIALTO_SERVER_LOG_DEBUG("elementName %s", elementName);
      64            5 :                 if (elementName && m_glibWrapper->gStrrstr(elementName, "decodebin"))
      65              :                 {
      66            4 :                     RIALTO_SERVER_LOG_DEBUG("m_context.playbackGroup.curAudioDecodeBin %s", elementName);
      67            4 :                     m_context.playbackGroup.m_curAudioDecodeBin = typeFindParent;
      68            4 :                     gchar *typefindName = m_gstWrapper->gstElementGetName(m_typefind);
      69            4 :                     RIALTO_SERVER_LOG_DEBUG("onTypeFound(): m_context.playbackGroup.curAudioTypefind %s", typefindName);
      70            4 :                     m_glibWrapper->gFree(typefindName);
      71            4 :                     m_context.playbackGroup.m_curAudioTypefind = m_typefind;
      72            4 :                     if (m_context.pendingUseBuffering.has_value())
      73              :                     {
      74            1 :                         m_player.setUseBuffering();
      75              :                     }
      76            4 :                     if (m_context.playbackGroup.m_linkTypefindParser && m_context.playbackGroup.m_curAudioTypefind &&
      77            2 :                         m_context.playbackGroup.m_curAudioParse)
      78              :                     {
      79            4 :                         if (m_gstWrapper->gstElementLink(m_context.playbackGroup.m_curAudioTypefind,
      80            2 :                                                          m_context.playbackGroup.m_curAudioParse))
      81              :                         {
      82            1 :                             RIALTO_SERVER_LOG_DEBUG("Linked typefind to parser");
      83            1 :                             m_context.playbackGroup.m_linkTypefindParser = false;
      84              :                         }
      85              :                         else
      86              :                         {
      87            1 :                             RIALTO_SERVER_LOG_DEBUG("Failed to link typefind to parser");
      88              :                         }
      89              :                     }
      90              :                 }
      91            5 :                 m_glibWrapper->gFree(elementName);
      92            5 :                 m_gstWrapper->gstObjectUnref(typeFindParent);
      93              :             }
      94              :         }
      95            7 :         m_glibWrapper->gFree(typefindCaps);
      96              :     }
      97              : }
      98              : } // namespace firebolt::rialto::server::tasks::generic
        

Generated by: LCOV version 2.0-1