Drain startup audio on END and validate Opus fixture failures
This commit is contained in:
1 parent
f42b085e12
commit
79701feef1
2 files changed
+11
-3
No files matched your search
@@ -186,7 +186,7 @@ void StreamPlayerWindow::decode() {
|
||||
uint32_t videoRevision = 0;
|
||||
auto reset = [&] {
|
||||
avcodec_free_context(&decoder);
|
||||
opus_codec_decoder_destroy(opus); opus = nullptr; expectedAudio = -1; waitKey = true;
|
||||
opus_codec_decoder_destroy(opus); opus = nullptr; expectedAudio = -1; waitKey = true; prerollSamples = 0;
|
||||
std::lock_guard<std::mutex> guard(p.lock);
|
||||
p.videos.clear(); p.videoBytes = 0; p.audios.clear(); p.prefillUntil = 0; p.videoBase = p.audioPts = -1;
|
||||
emit statusChanged(text("Waiting for a key frame…"));
|
||||
@@ -213,7 +213,11 @@ void StreamPlayerWindow::decode() {
|
||||
: record.reason == STREAM_CLOSE_GROUP ? "The channel is closed" : "Could not continue the stream";
|
||||
fail(text(reason)); break;
|
||||
}
|
||||
if (record.kind == StreamRecordKind::End) { std::lock_guard<std::mutex> guard(p.lock); p.ended = true; break; }
|
||||
if (record.kind == StreamRecordKind::End) {
|
||||
std::lock_guard<std::mutex> guard(p.lock); p.ended = true;
|
||||
if (p.videoBase < 0) p.audios.clear();
|
||||
break;
|
||||
}
|
||||
if (record.pts > INT64_MAX) { fail(text("Invalid stream timestamp")); break; }
|
||||
if (record.kind == StreamRecordKind::Audio) {
|
||||
if (!p.audioAvailable) continue;
|
||||
|
||||
@@ -196,7 +196,11 @@ private slots:
|
||||
pcm[2 * i + 1] = static_cast<int16_t>(1500 * std::sin((sampleFrame + i) * 0.13));
|
||||
}
|
||||
sampleFrame += 960;
|
||||
int length = opus_codec_encode(opus.get(), pcm, 960, encoded, sizeof(encoded)); QVERIFY(length > 0);
|
||||
int length = opus_codec_encode(opus.get(), pcm, 960, encoded, sizeof(encoded));
|
||||
if (length <= 0) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "desktop startup fixture Opus encode failed result=%d", length);
|
||||
return QList<QByteArray>{};
|
||||
}
|
||||
packets.append(QByteArray(reinterpret_cast<const char*>(encoded), length));
|
||||
}
|
||||
return packets;
|
||||
|
||||
Reference in new issue
Block a user