diff --git a/docs/CLI.md b/docs/CLI.md index a0bf000..9b2581c 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -331,10 +331,16 @@ macOS only; a Windows build rejects it. | `segment_bytes` | `65536` | As `--segment-bytes`, from 1 to 1048576 (1 MiB) | | `timeline` | `true` | `false` publishes no media timeline track, as `--no-timeline` | | `accessible_window_ms` | `300000` | As `--accessible-window`, in milliseconds, from 0 to 2000000000 | +| `strict_start` | `false` | `true` stops every program when one does not open at start-up | `ingest` holds exactly one of `srt` or `path`. An unknown key is refused. An invalid file exits with code 2, and the error names the field and the value. A program that ends, or whose read fails, ends its own track; the others go on. +A program that does not open at start-up, because the PAT does not list it or +its PMT does not come within 1 s of PCR time, is logged as an error and left +out of the catalog; the others publish, and the exit code is 1. With +`strict_start`, it stops every program instead. Only when no program opens does +the start fail. The tracks start at the live edge. While the relay has no subscriber, moq2ts keeps reading the source and drops its oldest packets. When the first @@ -487,6 +493,7 @@ no longer produced. automatically and advertised as `isLive: true`; VOD duration probing is skipped (it would otherwise open and consume the pipe a second time). - **Per-program mode over a pipe** works too: the PAT/PMT init scan is buffered and - replayed so no leading packets are lost. If the source never emits PAT/PMT within - the first ~4096 packets, per-program init fails with a clear error - use - `--unmodified` for such feeds. + replayed so no leading packets are lost. The scan waits for the PAT up to 1 s of + PCR time, then for its PMT up to 1 s after the PAT. A source without a PCR is + read up to 106,400 packets, about 20 MB (160 s at 1 Mbit/s). If the tables do not arrive, + per-program init fails with a clear error - use `--unmodified` for such feeds. diff --git a/src/app/PublisherSpec.cpp b/src/app/PublisherSpec.cpp index 63f0d1d..6b29a59 100644 --- a/src/app/PublisherSpec.cpp +++ b/src/app/PublisherSpec.cpp @@ -290,7 +290,8 @@ bool parsePublisherSpec(const QByteArray& json, PublisherSpec* out, QString* err const QJsonObject root = document.object(); if (!checkKeys(root, QString(), {QStringLiteral("relay"), QStringLiteral("ingest"), QStringLiteral("programs"), - QStringLiteral("segment_bytes"), QStringLiteral("timeline"), QStringLiteral("accessible_window_ms")}, + QStringLiteral("segment_bytes"), QStringLiteral("timeline"), QStringLiteral("accessible_window_ms"), + QStringLiteral("strict_start")}, error)) { return false; } @@ -315,6 +316,13 @@ bool parsePublisherSpec(const QByteArray& json, PublisherSpec* out, QString* err } spec.relay.timelineTrack = timeline.toBool(); } + const QJsonValue strictStart = root.value(QStringLiteral("strict_start")); + if (!strictStart.isUndefined()) { + if (!strictStart.isBool()) { + return fail(error, QStringLiteral("strict_start: %1 is not true or false.").arg(jsonText(strictStart))); + } + spec.strictStart = strictStart.toBool(); + } if (out != nullptr) { *out = spec; } diff --git a/src/app/PublisherSpec.h b/src/app/PublisherSpec.h index 76bd121..65faf23 100644 --- a/src/app/PublisherSpec.h +++ b/src/app/PublisherSpec.h @@ -30,6 +30,8 @@ struct PublisherSpec { QString sourcePath; QList programs; int segmentBytes = 64 * 1024; + // MptsConfig::strictStart. + bool strictStart = false; }; // Reads a publisher configuration: @@ -40,7 +42,7 @@ struct PublisherSpec { // "programs": [ { "number": 101, "mux_rate_bps": 6000000, "si": ["sdt", "eit-pf", "tdt-tot"] }, // { "number": 102 } ], // "segment_bytes": 65536, -// "timeline": true, "accessible_window_ms": 300000 +// "timeline": true, "accessible_window_ms": 300000, "strict_start": false // } // "ingest" holds exactly one of "srt" or "path" (a FIFO). An unknown key // fails. On failure, error names the field and the value, and out is left diff --git a/src/cli/main_cli.cpp b/src/cli/main_cli.cpp index 4514594..c65c62b 100644 --- a/src/cli/main_cli.cpp +++ b/src/cli/main_cli.cpp @@ -153,6 +153,7 @@ int runConfig(QCoreApplication& app, const QString& path) { mpts.sourcePath = spec.sourcePath; mpts.programs = spec.programs; mpts.targetSegmentBytes = spec.segmentBytes; + mpts.strictStart = spec.strictStart; const bool useSrt = !spec.srt.mode.isEmpty(); #ifndef MOQ2TS_HAS_SRT diff --git a/src/media/M2tsPacketizer.cpp b/src/media/M2tsPacketizer.cpp index b852416..e8ebaff 100644 --- a/src/media/M2tsPacketizer.cpp +++ b/src/media/M2tsPacketizer.cpp @@ -26,8 +26,11 @@ constexpr std::int64_t kPcrHz = 27000000; constexpr std::int64_t kPsiWindowPcr = 1 * kPcrHz; // twice the 500 ms PSI limit of ETSI TR 101 290 constexpr std::int64_t kRapWindowPcr = 10 * kPcrHz; constexpr int kTimedWindowMaxPackets = 600000; -// A window whose PCR does not advance for this long ends with an error: the -// packets of about 2 s at 80 Mbit/s, or 2 s of wall time on a slower source. +// The PSI scan of a live source of one program keeps the packets it reads, so +// it reads at most its two windows at 80 Mbit/s (about 20 MB). +constexpr int kLivePsiMaxPackets = 106400; +// A timed window whose PCR does not advance for this long ends with an error: +// the packets of about 2 s at 80 Mbit/s, or 2 s of wall time on a slower source. constexpr int kPcrStallPackets = 100000; constexpr auto kPcrStallTime = std::chrono::seconds(2); // The largest step between two PCRs of a PID that counts as time: ISO/IEC @@ -696,18 +699,29 @@ bool M2tsPacketizer::scanPsi(QString* error) { return fail(QStringLiteral("Failed to seek M2TS source while reading the PAT and PMT.")); } - // A file, or the source of one program, reads 4096 packets at most. A - // program of a live multiplex reads the whole multiplex, so its window is - // PCR time. + // A file reads 4096 packets at most. A live source waits for the PAT up to + // kPsiWindowPcr of PCR time, then for the PMT up to kPsiWindowPcr after the + // PAT (ETSI TR 101 290 allows 500 ms between two of each), since a fixed + // number of packets is a shorter time at a higher rate. A live source of + // one program without an advancing PCR stops at kLivePsiMaxPackets. constexpr int maxPacketsToScan = 4096; PcrSpan span(-1); + std::int64_t patAt = -1; // PCR time of the first PAT read const auto inWindow = [&](int index) { - return m_timedStartWindows ? index < kTimedWindowMaxPackets && span.elapsed() < kPsiWindowPcr - : index < maxPacketsToScan; + if (!m_sequential && !m_timedStartWindows) { + return index < maxPacketsToScan; + } + const std::int64_t limit = patAt < 0 ? kPsiWindowPcr : patAt + kPsiWindowPcr; + if (m_timedStartWindows) { + return index < kTimedWindowMaxPackets && span.elapsed() < limit; + } + return index < kLivePsiMaxPackets && span.elapsed() < limit; }; + bool sourceEnded = false; for (int index = 0; inWindow(index) && !psiComplete(); ++index) { const QByteArray sourcePacket = readSourcePacket(); if (sourcePacket.size() != m_packetSize) { + sourceEnded = true; break; } // On non-seekable input we cannot rewind after the scan, so retain every @@ -725,6 +739,9 @@ bool M2tsPacketizer::scanPsi(QString* error) { const QByteArray tsPacket = tsPacketView(sourcePacket); span.add(pidOf(tsPacket), tsPacket); handlePsiPacket(tsPacket, sourcePacket); + if (patAt < 0 && !m_pat.bytes.isEmpty()) { + patAt = span.elapsed(); + } if (m_timedStartWindows && !psiComplete() && span.stalled()) { return fail(QStringLiteral("No advancing PCR in the live source while reading the PAT and PMT; the " "start-up windows of a program of a multiplex are PCR time.")); @@ -739,6 +756,13 @@ bool M2tsPacketizer::scanPsi(QString* error) { if (m_pmtPid < 0 && m_requestedProgramNumber != 0 && !m_patPrograms.empty()) { return fail(QStringLiteral("Requested program %1 was not found in PAT.").arg(m_requestedProgramNumber)); } + if (m_pmt.bytes.isEmpty() && m_pmtPid >= 0 && patAt >= 0 && !sourceEnded) { + return fail(QStringLiteral("The PAT lists program %1, but its PMT (PID %2) did not come within %3 ms of PCR " + "time after the PAT.") + .arg(m_requestedProgramNumber) + .arg(m_pmtPid) + .arg(kPsiWindowPcr * 1000 / kPcrHz)); + } if (m_pmt.bytes.isEmpty()) { return fail(QStringLiteral("Failed to collect PAT/PMT packets for catalog initData.")); } diff --git a/src/media/M2tsPacketizer.h b/src/media/M2tsPacketizer.h index b24e3c9..8caa6ca 100644 --- a/src/media/M2tsPacketizer.h +++ b/src/media/M2tsPacketizer.h @@ -233,8 +233,9 @@ class M2tsPacketizer final { private: bool detectPacketSize(QString* error); - // Reads up to 4096 packets (or 1 s of PCR time, see setTimedStartWindows) - // for the PAT and the selected program's PMT. + // Reads the PAT and the selected program's PMT: up to 4096 packets of a + // file; on a live source, up to 1 s of PCR time for the PAT, then 1 s + // after it for the PMT. bool scanPsi(QString* error); void handlePsiPacket(const QByteArray& tsPacket, const QByteArray& sourcePacket); void onPat(const PsiAssembler::Section& section); diff --git a/src/media/MptsPipeline.cpp b/src/media/MptsPipeline.cpp index f7fdd80..e64efe2 100644 --- a/src/media/MptsPipeline.cpp +++ b/src/media/MptsPipeline.cpp @@ -405,20 +405,43 @@ void MptsPipeline::run() { opener.join(); } } + // A program that did not open is left out and reported, and the others + // publish. Strict start, or no program open, fails as one error. + std::vector> openPrograms; + QStringList notOpened; for (std::size_t index = 0; index < programs.size(); ++index) { Program* program = programs[index].get(); const M2tsPacketizer& packetizer = *program->packetizer; if (!programOpened[index]) { // A PAT that was read and does not list the program. - if (packetizer.patProgramCount() > 0 && packetizer.pmtPid() < 0) { - fail(QStringLiteral("program %1 is not in the source PAT").arg(program->config.programNumber)); - } else { - fail(QStringLiteral("program %1: %2").arg(program->config.programNumber).arg(openErrors[index])); + const QString why = packetizer.patProgramCount() > 0 && packetizer.pmtPid() < 0 + ? QStringLiteral("program %1 is not in the source PAT").arg(program->config.programNumber) + : QStringLiteral("program %1: %2").arg(program->config.programNumber).arg(openErrors[index]); + if (m_config.strictStart) { + fail(why); + return; } - return; + notOpened.append(why); + continue; } program->packetsPerObject = std::max(1, m_config.targetSegmentBytes / packetizer.packetSize()); + openPrograms.push_back(std::move(programs[index])); + } + if (openPrograms.empty()) { + fail(notOpened.front()); + return; + } + for (std::size_t index = 0; index < programs.size(); ++index) { + if (programs[index]) { + QString reason = notOpened.takeFirst(); + if (!reason.endsWith(QLatin1Char('.'))) { + reason += QLatin1Char('.'); + } + emit programEnded(programs[index]->config.programNumber, + reason + QStringLiteral(" The other programs publish without it.")); + } } + programs = std::move(openPrograms); // One catalog entry per program, as LivePipeline builds a live per-program // track. diff --git a/src/media/MptsPipeline.h b/src/media/MptsPipeline.h index c954fdf..f398e5d 100644 --- a/src/media/MptsPipeline.h +++ b/src/media/MptsPipeline.h @@ -38,6 +38,9 @@ struct MptsConfig { int targetSegmentBytes = 64 * 1024; // Where SRT ingest skipped ahead in the source; null outside SRT ingest. std::shared_ptr sourceGaps; + // A program that does not open at start-up fails every program. Without + // it, the others publish and programEnded() reports that one. + bool strictStart = false; }; // Publishes several programs of one live multi-program source in one MOQT @@ -63,8 +66,8 @@ class MptsPipeline final : public QObject { ~MptsPipeline() override; // Starts the pipeline on a thread of its own and returns. Start-up errors - // (a seekable source, a program missing from the PAT) come as error(), and - // running() then turns false. The publisher (a MoqxrPublisher, or a + // (a seekable source, no program open, or with strictStart one program not + // open) come as error(), and running() then turns false. The publisher (a MoqxrPublisher, or a // stand-in in tests) must be connected. void start(const PublishConfig& relay, const MptsConfig& config, IMoqOutput* publisher); // Stops the source, the workers, and the publish loop, and joins them. A @@ -82,8 +85,9 @@ class MptsPipeline final : public QObject { void status(const QString& message); // A start-up or publish error, which ends the pipeline. void error(const QString& message); - // A read error of one program, which ends that program's track only; the - // session goes on with the other programs. + // A program that did not open at start-up, or a read error of one program, + // which ends that program's track only; the session goes on with the + // other programs. void programEnded(int program, const QString& reason); // The publisher's first pull: every program queue dropped what it held, // so what the source sends from now on is what the tracks start with. diff --git a/tests/m2ts_packetizer_test.cpp b/tests/m2ts_packetizer_test.cpp index 301b2b3..ca2d641 100644 --- a/tests/m2ts_packetizer_test.cpp +++ b/tests/m2ts_packetizer_test.cpp @@ -1674,6 +1674,93 @@ int main() { } } + // The PSI scan of a live source waits for the PAT, up to 1 s of PCR time, + // then for its PMT, up to 1 s after the PAT (ETSI TR 101 290 allows 500 ms + // between two of each). 4096 packets are only 154 ms at 40 Mbit/s. The + // source runs at 40 Mbit/s (532 packets per 20 ms PCR step) for 3 s and + // starts just after a PAT. + // The same windows apply to a program of a multiplex (timed windows, + // per-program carriage), and a PCR that jumps back at the start only + // stretches the window. + struct PsiCase { + std::string label; + double patFirst; // s: the first PAT, then one every 476 ms; < 0: none + double pmtDelay; // s: each PMT after its PAT + bool timed; // timed windows and per-program carriage of program 1 + double pcrJump; // s: the PCR restarts from 0 at this time; < 0: never + }; + for (const PsiCase& c : {PsiCase{"live PSI, PAT at 476 ms: ", 0.476, 0.0, false, -1.0}, + PsiCase{"live PSI, PMT 450 ms after a PAT at 950 ms: ", 0.95, 0.45, false, -1.0}, + PsiCase{"live PSI, no PAT: ", -1.0, 0.0, false, -1.0}, + PsiCase{"timed PSI, PMT 450 ms after a PAT at 950 ms: ", 0.95, 0.45, true, -1.0}, + PsiCase{"live PSI, PCR back to 0 at 100 ms: ", 0.476, 0.0, false, 0.1}}) { + QByteArray ts; + int videoCc = 0; + int psiCc = 0; + double nextPat = c.patFirst; + double nextPmt = c.patFirst < 0 ? -1.0 : c.patFirst + c.pmtDelay; + for (int step = 0; step < 150; ++step) { + const double t = step * 0.02; + const double pcrT = c.pcrJump >= 0 && t >= c.pcrJump ? t - c.pcrJump : t + (c.pcrJump >= 0 ? 10.0 : 0.0); + ts += pcrPacket(0x100, static_cast(pcrT * 27e6), videoCc++); + int left = 531; + if (nextPat >= 0 && t >= nextPat) { + ts += tb::psiPacket(0x0000, tb::patSection({{1, 0x1000}}), psiCc); + nextPat += 0.476; + --left; + } + if (nextPmt >= 0 && t >= nextPmt) { + ts += tb::psiPacket(0x1000, tb::pmtSection(1, 0x100, {{0x1B, 0x100}}), psiCc++); + ts += tb::tsPacket(0x100, true, tb::pesHeaderWithPts(static_cast(t * 90000)), + videoCc++, 0x40); + nextPmt += 0.476; + left -= 2; + } + for (int k = 0; k < left; ++k) { + ts += tb::tsPacket(0x100, false, QByteArray(184, char(k)), videoCc++); + } + } + auto device = std::make_shared(ts); + M2tsPacketizer packetizer(device, QStringLiteral("live")); + packetizer.setTransparent(!c.timed); + packetizer.setTimedStartWindows(c.timed); + QString error; + const bool opened = packetizer.open(c.timed ? 1 : 0, &error); + if (c.patFirst >= 0) { + ok &= expect(opened, c.label + "opens: " + error.toStdString()); + ok &= expect(packetizer.pcrPid() == 0x100 && !packetizer.initData().isEmpty(), + c.label + "reads the PMT, so initData carries it"); + } else { + const qint64 read = ts.size() - device->bytesAvailable(); + ok &= expect(!opened && read <= ts.size() / 2, + c.label + "fails after about 1 s, read " + std::to_string(read / 188) + " packets"); + } + } + + // The scan keeps what it reads, so a live source whose PCR never ends the + // window (none at all, or one that advances too slowly) stops at the + // packet cap (106,400 packets). + for (const bool withPcr : {false, true}) { + const std::string label = withPcr ? "live PSI, slow PCR: " : "live PSI, no PCR: "; + QByteArray ts; + int videoCc = 0; + for (int step = 0; step < 240; ++step) { + ts += withPcr ? pcrPacket(0x100, step * 27, videoCc++) // 1 us per step + : tb::tsPacket(0x100, false, QByteArray(184, char(0)), videoCc++); + for (int k = 0; k < 499; ++k) { + ts += tb::tsPacket(0x100, false, QByteArray(184, char(k)), videoCc++); + } + } + auto device = std::make_shared(ts); + M2tsPacketizer packetizer(device, QStringLiteral("live")); + packetizer.setTransparent(true); + QString error; + const bool opened = packetizer.open(0, &error); + const qint64 read = (ts.size() - device->bytesAvailable()) / 188; + ok &= expect(!opened && read >= 106400 && read < 107000, + label + "stops at the packet cap, read " + std::to_string(read) + " packets"); + } + // Timed Groups for the sources that #40 left in Group 0 (#49), on 20 s of // a live source (the PCR advances 0.1 s per round): // - audio: an audio-only program whose PCR travels on a PID of its own. diff --git a/tests/mpts_pipeline_test.cpp b/tests/mpts_pipeline_test.cpp index ce1fc36..95ec860 100644 --- a/tests/mpts_pipeline_test.cpp +++ b/tests/mpts_pipeline_test.cpp @@ -314,6 +314,7 @@ using Feed = std::function sourceGaps; + bool strictStart = false; std::function relay; std::function& running)> beforeFirstPull; }; @@ -338,6 +339,7 @@ Run publish(const QString& source, const QList& programs, con config.programs = programs; config.targetSegmentBytes = 4 * 188; config.sourceGaps = options.sourceGaps; + config.strictStart = options.strictStart; Run run; std::mutex errorMutex; @@ -494,6 +496,18 @@ int pidOf(const QByteArray& packet) { } // The flags octet of the adaptation field, or 0 without one. +// data without the packets of these PIDs. +QByteArray withoutPids(const QByteArray& data, const QList& pids) { + QByteArray out; + for (qsizetype offset = 0; offset + 188 <= data.size(); offset += 188) { + const QByteArray packet = data.mid(offset, 188); + if (!pids.contains(pidOf(packet))) { + out += packet; + } + } + return out; +} + int adaptationFlags(const QByteArray& packet) { const bool adaptation = ((static_cast(packet[3]) >> 4) & 0x03) >= 2; return adaptation && static_cast(packet[4]) >= 1 ? static_cast(packet[5]) : 0; @@ -620,14 +634,61 @@ int main() { "low mux rate: one warning, for program 102: " + joined(below)); } - // Program 103 missing from the PAT: start fails with an error naming 103. + // Program 103 missing from the PAT: programs 101 and 102 publish, and + // programEnded reports 103 once, before anything is published. { const Run run = publish(dir.filePath("missing.fifo"), {program(101), program(102), program(103)}, - mptsStream({101, 102}, 60)); - ok &= expect(run.finished, "missing program: the pipeline stops"); + QByteArray(), liveFeed(mptsStream({101, 102}, 60), roundsBytes(2, 15))); + ok &= expect(run.finished, "missing program: the pipeline ends with the source"); + ok &= expect(run.errors.isEmpty(), "missing program: no pipeline error: " + joined(run.errors)); + ok &= expect(run.ended == QStringList({"103: program 103 is not in the source PAT. The other programs " + "publish without it."}), + "missing program: programEnded names 103 once: " + joined(run.ended)); + const QStringList tracks = publishedTracks(run.log); + ok &= expect(tracks.count(QStringLiteral("program-101")) > 0 && tracks.count(QStringLiteral("program-102")) > 0 && + !tracks.contains(QStringLiteral("program-103")), + "missing program: 101 and 102 publish, 103 does not"); + ok &= expect(catalogTracks(run.catalog) == QStringList({"program-101", "program-101.timeline", "program-102", + "program-102.timeline"}), + "missing program: the catalog lists 101 and 102 only: " + run.catalog.toStdString()); + } + + // The same with strict_start: start fails with an error naming 103, and + // nothing is published, as before. + { + const Run run = publish(dir.filePath("missing-strict.fifo"), {program(101), program(102), program(103)}, + mptsStream({101, 102}, 60), {}, {}, Options{.strictStart = true}); + ok &= expect(run.finished, "strict start: the pipeline stops"); + ok &= expect(run.errors.contains(QStringLiteral("program 103 is not in the source PAT")), + "strict start: the error names 103: " + joined(run.errors)); + ok &= expect(publishedTracks(run.log).isEmpty(), "strict start: nothing is published"); + } + + // No program opens: start fails, as before. + { + const Run run = publish(dir.filePath("none.fifo"), {program(103), program(104)}, mptsStream({101, 102}, 60)); + ok &= expect(run.finished, "no program opens: the pipeline stops"); ok &= expect(run.errors.contains(QStringLiteral("program 103 is not in the source PAT")), - "missing program: the error names 103: " + joined(run.errors)); - ok &= expect(publishedTracks(run.log).isEmpty(), "missing program: nothing is published"); + "no program opens: the error names the first program: " + joined(run.errors)); + ok &= expect(run.ended.isEmpty(), "no program opens: no programEnded: " + joined(run.ended)); + ok &= expect(publishedTracks(run.log).isEmpty(), "no program opens: nothing is published"); + } + + // The PAT lists program 102, but its PMT never comes, as when its encoder + // is down: 101 publishes, and programEnded says that 102's PMT is missing. + { + const QByteArray data = withoutPids(mptsStream({101, 102}, 60), {0x1001, 0x101}); + const Run run = publish(dir.filePath("no-pmt.fifo"), {program(101), program(102)}, QByteArray(), + liveFeed(data, roundsBytes(1, 15))); + ok &= expect(run.finished, "missing PMT: the pipeline ends with the source"); + ok &= expect(run.errors.isEmpty(), "missing PMT: no pipeline error: " + joined(run.errors)); + ok &= expect(run.ended == QStringList({"102: program 102: The PAT lists program 102, but its PMT (PID 4097) " + "did not come within 1000 ms of PCR time after the PAT. The other " + "programs publish without it."}), + "missing PMT: programEnded names 102 and its PMT: " + joined(run.ended)); + const QStringList tracks = publishedTracks(run.log); + ok &= expect(tracks.count(QStringLiteral("program-101")) > 0 && !tracks.contains(QStringLiteral("program-102")), + "missing PMT: 101 publishes, 102 does not"); } // Program 101's PMT changes: one new catalog Object, and program 102 keeps diff --git a/tests/publisher_spec_test.cpp b/tests/publisher_spec_test.cpp index 87526da..ecbdc08 100644 --- a/tests/publisher_spec_test.cpp +++ b/tests/publisher_spec_test.cpp @@ -160,6 +160,22 @@ int main() { {QStringLiteral("accessible_window_ms: -1 is not an integer from 0 to 2000000000.")}, "a negative accessible window"); + // strict_start: off by default, so a program that does not open leaves the + // others publishing; true stops every program, as before. + { + PublisherSpec spec; + QString error; + ok &= expect(parsePublisherSpec(kExample, &spec, &error) && !spec.strictStart, + "strict_start defaults to off: " + error.toStdString()); + ok &= expect(parsePublisherSpec(exampleWith(R"("segment_bytes": 65536)", + R"("segment_bytes": 65536, "strict_start": true)"), + &spec, &error) && + spec.strictStart, + "strict_start parses: " + error.toStdString()); + } + ok &= rejects(exampleWith(R"("segment_bytes": 65536)", R"("segment_bytes": 65536, "strict_start": 1)"), + {QStringLiteral("strict_start: 1 is not true or false.")}, "a strict_start that is not a boolean"); + // The relay authorization token, opaque to moq2ts: a value or a file, of // the token type that the relay expects (16 by default, as moqx). {