GCC Code Coverage Report


Directory: ./
File: mediaoutput/PipeWireGraphConfig.cpp
Date: 2026-10-29 08:11:58
Exec Total Coverage
Lines: 17 19 89.5%
Functions: 1 1 100.0%
Branches: 18 26 69.2%

Line Branch Exec Source
1 /*
2 * This file is part of the Falcon Player (FPP) and is Copyright (C)
3 * 2013-2025 by the Falcon Player Developers.
4 *
5 * The Falcon Player (FPP) is free software, and is covered under
6 * multiple Open Source licenses. Please see the included 'LICENSES'
7 * file for descriptions of what files are covered by each license.
8 *
9 * This source file is covered under the LGPL v2.1 as described in the
10 * included LICENSE.LGPL file.
11 */
12
13 #include "fpp-pch.h"
14
15 #include "PipeWireGraphConfig.h"
16
17 #include "common.h"
18
19 // See the header for why this reads the generated conf rather than the graph.
20 88 bool PipeWireGraphFeedsNode(const std::string& nodeName) {
21 static const char* confs[] = {
22 "/etc/pipewire/pipewire.conf.d/97-fpp-audio-groups.conf",
23 "/etc/pipewire/pipewire.conf.d/96-fpp-input-groups.conf"
24 };
25
26
4/6
✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 84 times.
✓ Branch 5 taken 4 times.
176 if (GetFileContents(confs[0]).empty()) {
27 84 return true;
28 }
29
30
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 const std::string needle = "node.target";
31
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
8 for (const char* conf : confs) {
32
2/4
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
6 const std::string contents = GetFileContents(conf);
33
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 4 times.
9 for (std::size_t t = contents.find(needle); t != std::string::npos;
34 3 t = contents.find(needle, t + 1)) {
35 // node.target = "<value>" -- take what is between the next two
36 // quotes and compare whole, so aes67_stream_1_send does not match
37 // a hypothetical aes67_stream_10_send.
38 5 std::size_t a = contents.find('"', t + needle.size());
39
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (a == std::string::npos) {
40 ✗ continue;
41 }
42 5 std::size_t b = contents.find('"', a + 1);
43
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if (b == std::string::npos) {
44 ✗ continue;
45 }
46
3/4
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 3 times.
5 if (contents.compare(a + 1, b - a - 1, nodeName) == 0) {
47 2 return true;
48 }
49 }
50
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 }
51 2 return false;
52 4 }
53