• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stef1949 / LumiFur_Controller / 24296808563

12 Apr 2026 02:27AM UTC coverage: 37.075% (+4.7%) from 32.346%
24296808563

Pull #56

github

web-flow
Merge c409f0263 into 9e562fd56
Pull Request #56: Dev

73 of 94 new or added lines in 3 files covered. (77.66%)

360 of 971 relevant lines covered (37.08%)

125.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.96
/src/core/video/MonoVideoCodec.cpp
1
#include "core/video/MonoVideoCodec.h"
2

3
#include <cstring>
4

5
namespace video
6
{
7

NEW
8
bool isSupportedEncoding(uint8_t encoding)
×
9
{
NEW
10
  return encoding == static_cast<uint8_t>(FrameEncoding::KeyframeRaw) ||
×
NEW
11
         encoding == static_cast<uint8_t>(FrameEncoding::DeltaRuns);
×
12
}
13

14
bool isValidHeader(const MonoVideoHeader &header, uint16_t expectedWidth, uint16_t expectedHeight)
2✔
15
{
16
  if (std::memcmp(header.magic, kMonoVideoMagic, sizeof(kMonoVideoMagic)) != 0)
2✔
17
  {
NEW
18
    return false;
×
19
  }
20
  if (header.width == 0 || header.height == 0)
2✔
21
  {
NEW
22
    return false;
×
23
  }
24
  if ((header.width % 8U) != 0U)
2✔
25
  {
26
    return false;
1✔
27
  }
28
  if (expectedWidth != 0 && header.width != expectedWidth)
1✔
29
  {
NEW
30
    return false;
×
31
  }
32
  if (expectedHeight != 0 && header.height != expectedHeight)
1✔
33
  {
NEW
34
    return false;
×
35
  }
36

37
  const size_t expectedBytes = bytesPerFrameForDimensions(header.width, header.height);
1✔
38
  if (expectedBytes == 0 || expectedBytes > UINT16_MAX)
1✔
39
  {
NEW
40
    return false;
×
41
  }
42
  if (header.bytesPerFrame != expectedBytes)
1✔
43
  {
NEW
44
    return false;
×
45
  }
46
  if (header.frameCount == 0 || header.frameIntervalMicros == 0)
1✔
47
  {
NEW
48
    return false;
×
49
  }
50
  return true;
1✔
51
}
52

53
bool applyFramePayload(FrameEncoding encoding,
4✔
54
                       const uint8_t *payload,
55
                       size_t payloadSize,
56
                       uint8_t *frameBuffer,
57
                       size_t frameBufferSize)
58
{
59
  if (!payload || !frameBuffer || frameBufferSize == 0)
4✔
60
  {
NEW
61
    return false;
×
62
  }
63

64
  switch (encoding)
4✔
65
  {
66
  case FrameEncoding::KeyframeRaw:
1✔
67
    if (payloadSize != frameBufferSize)
1✔
68
    {
NEW
69
      return false;
×
70
    }
71
    std::memcpy(frameBuffer, payload, frameBufferSize);
1✔
72
    return true;
1✔
73

74
  case FrameEncoding::DeltaRuns:
3✔
75
  {
76
    size_t cursor = 0;
3✔
77
    while (cursor < payloadSize)
5✔
78
    {
79
      if ((payloadSize - cursor) < sizeof(DeltaRunHeader))
3✔
80
      {
81
        return false;
1✔
82
      }
83

84
      DeltaRunHeader run{};
3✔
85
      std::memcpy(&run, payload + cursor, sizeof(run));
3✔
86
      cursor += sizeof(run);
3✔
87

88
      if (run.length == 0)
3✔
89
      {
NEW
90
        return false;
×
91
      }
92
      if (static_cast<size_t>(run.offset) + static_cast<size_t>(run.length) > frameBufferSize)
3✔
93
      {
94
        return false;
1✔
95
      }
96
      if ((payloadSize - cursor) < run.length)
2✔
97
      {
NEW
98
        return false;
×
99
      }
100

101
      std::memcpy(frameBuffer + run.offset, payload + cursor, run.length);
2✔
102
      cursor += run.length;
2✔
103
    }
104
    return true;
2✔
105
  }
106

NEW
107
  default:
×
NEW
108
    return false;
×
109
  }
110
}
111

NEW
112
bool applyFramePayload(uint8_t encoding,
×
113
                       const uint8_t *payload,
114
                       size_t payloadSize,
115
                       uint8_t *frameBuffer,
116
                       size_t frameBufferSize)
117
{
NEW
118
  if (!isSupportedEncoding(encoding))
×
119
  {
NEW
120
    return false;
×
121
  }
NEW
122
  return applyFramePayload(static_cast<FrameEncoding>(encoding), payload, payloadSize, frameBuffer, frameBufferSize);
×
123
}
124

125
} // namespace video
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc