LCOV - code coverage report
Current view: top level - media/server/gstplayer/source - FlushWatcher.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 16 16
Test Date: 2025-06-30 09:40:50 Functions: 100.0 % 5 5

            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 2025 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 "FlushWatcher.h"
      21              : #include <algorithm>
      22              : 
      23              : namespace firebolt::rialto::server
      24              : {
      25            2 : void FlushWatcher::setFlushing(const MediaSourceType &type, bool async)
      26              : {
      27            2 :     std::unique_lock lock{m_mutex};
      28            2 :     if (MediaSourceType::UNKNOWN != type)
      29              :     {
      30            2 :         m_flushingSources[type] = async;
      31              :     }
      32              : }
      33              : 
      34            2 : void FlushWatcher::setFlushed(const MediaSourceType &type)
      35              : {
      36            2 :     std::unique_lock lock{m_mutex};
      37            2 :     m_flushingSources.erase(type);
      38              : }
      39              : 
      40            5 : bool FlushWatcher::isFlushOngoing() const
      41              : {
      42            5 :     std::unique_lock lock{m_mutex};
      43           10 :     return !m_flushingSources.empty();
      44            5 : }
      45              : 
      46            4 : bool FlushWatcher::isAsyncFlushOngoing() const
      47              : {
      48            4 :     std::unique_lock lock{m_mutex};
      49            4 :     return !m_flushingSources.empty() && std::any_of(m_flushingSources.begin(), m_flushingSources.end(),
      50            8 :                                                      [](const auto &source) { return source.second; });
      51            4 : }
      52              : } // namespace firebolt::rialto::server
        

Generated by: LCOV version 2.0-1