Verify live desktop codec changes preserve the audio epoch
This commit is contained in:
1 parent
b5f84d4a9b
commit
e99a1b9450
2 files changed
+18
-12
No files matched your search
@@ -428,17 +428,19 @@ void StreamPublishEngine::videoLoop() {
|
||||
if (generation == m->generation) { emit configurationChanged(); emit stateChanged(text("Live")); }
|
||||
});
|
||||
} else {
|
||||
auto candidate = std::make_unique<StreamVideoEncoder>();
|
||||
if (!candidate->open(config.video)) {
|
||||
QString error = candidate->error();
|
||||
QMetaObject::invokeMethod(this, [this, generation, error] { sourceFailed(generation, error); });
|
||||
std::unique_lock<std::mutex> lock(m->lock);
|
||||
m->wake.wait_for(lock, std::chrono::milliseconds(100), [this, generation] { return !m->running || m->generation != generation; });
|
||||
continue;
|
||||
}
|
||||
encoder = std::move(candidate); current = generation; encoding = config; revision++; lastImage = {}; lastKey = -1000000;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_VIDEO, "desktop video prepared generation=%llu revision=%u encoder=%s",
|
||||
(unsigned long long)generation, revision, qPrintable(encoder->name()));
|
||||
auto candidate = std::make_unique<StreamVideoEncoder>();
|
||||
if (!candidate->open(config.video)) {
|
||||
QString error = candidate->error();
|
||||
QMetaObject::invokeMethod(this, [this, generation, error] { sourceFailed(generation, error); });
|
||||
std::unique_lock<std::mutex> lock(m->lock);
|
||||
m->wake.wait_for(lock, std::chrono::milliseconds(100), [this, generation] {
|
||||
return !m->running || m->generation != generation;
|
||||
});
|
||||
continue;
|
||||
}
|
||||
encoder = std::move(candidate); current = generation; encoding = config; revision++; lastImage = {}; lastKey = -1000000;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_VIDEO, "desktop video prepared generation=%llu revision=%u encoder=%s",
|
||||
(unsigned long long)generation, revision, qPrintable(encoder->name()));
|
||||
}
|
||||
}
|
||||
bool screen = config.source.kind != StreamVideoSource::Camera;
|
||||
|
||||
@@ -253,12 +253,16 @@ private slots:
|
||||
QVERIFY(video >= 10); QVERIFY(audio >= 40); QVERIFY(latest > first + 1000000); QVERIFY(left && right > left * 3);
|
||||
opus_codec_decoder_destroy(decoder);
|
||||
auto next = config; next.video.bitrate = 1000000; next.video.rotation = 90;
|
||||
if (engine.codecs().contains(STREAM_MEDIA_VP9)) next.video.codec = STREAM_MEDIA_VP9;
|
||||
QVERIFY(engine.reconfigure(next)); bool revised = false;
|
||||
elapsed.restart(); while (!revised && elapsed.elapsed() < 5000) {
|
||||
if (gui_stream_pull(202, out, 0, 60000000, 60000000) && out.kind == StreamRecordKind::Video && out.format.revision >= 2) revised = true;
|
||||
QTest::qWait(1);
|
||||
}
|
||||
QVERIFY(revised); QCOMPARE(out.format.rotation, (uint16_t)90);
|
||||
QVERIFY(revised); QCOMPARE(out.format.rotation, (uint16_t)90); QCOMPARE(out.format.video_codec, (uint8_t)next.video.codec);
|
||||
QVERIFY(record(202, StreamRecordKind::Audio, out)); QVERIFY(out.pts > first + 1000000);
|
||||
stream_member_state member{};
|
||||
QCOMPARE(stream_member_load(inst, group, inst->node_id, &member, nullptr), STREAM_OK); QCOMPARE(member.source.source_epoch, epoch);
|
||||
auto invalid = next; invalid.video.fps = 61;
|
||||
QVERIFY(engine.reconfigure(invalid));
|
||||
QTRY_COMPARE_WITH_TIMEOUT(engine.config().video.fps, 15, 5000);
|
||||
|
||||
Reference in new issue
Block a user