Files
EchoionCore/tests/test_gapless_handoff.cpp
T
faumaray a6555d4c69
Independent component release / publish (push) Failing after 11s
Enforce signed licenses and seamless track handoff
2026-08-02 01:47:23 +03:00

35 lines
913 B
C++

#include "echoion/core/playback/GaplessHandoff.hpp"
#include <iostream>
namespace
{
int failures = 0;
void expect(bool condition, const char* message)
{
if (!condition) {
std::cerr << "FAILED: " << message << '\n';
++failures;
}
}
} // namespace
int main()
{
using Echoion::Core::PlaybackDetail::canFillDeviceFrame;
expect(canFillDeviceFrame(300, 700, 1000),
"outgoing tail and incoming head can exactly fill a frame");
expect(canFillDeviceFrame(300, 900, 1000),
"extra incoming PCM is retained for the next frame");
expect(!canFillDeviceFrame(300, 699, 1000),
"handoff waits rather than padding when incoming PCM is short");
expect(!canFillDeviceFrame(0, 1000, 1000),
"an empty outgoing tail is a normal track-end path");
expect(!canFillDeviceFrame(1000, 1000, 1000),
"a complete outgoing frame does not need a boundary join");
return failures == 0 ? 0 : 1;
}