Align desktop audio startup with the first decoded video frame
This commit is contained in:
1 parent
60aaa16327
commit
f42b085e12
2 files changed
+31
-7
No files matched your search
@@ -187,8 +187,7 @@ private slots:
|
||||
#endif
|
||||
StreamPlayerWindow window(group, inst->node_id, epoch, "Source");
|
||||
QSignalSpy shown(&window, &StreamPlayerWindow::framePresented); window.show();
|
||||
QTimer sender;
|
||||
connect(&sender, &QTimer::timeout, this, [this, video, &opus, &sampleFrame] {
|
||||
auto audioPackets = [&opus, &sampleFrame] {
|
||||
QList<QByteArray> packets;
|
||||
if (opus) for (unsigned frame = 0; frame < 5; frame++) {
|
||||
int16_t pcm[1920]; uint8_t encoded[1275];
|
||||
@@ -200,7 +199,18 @@ private slots:
|
||||
int length = opus_codec_encode(opus.get(), pcm, 960, encoded, sizeof(encoded)); QVERIFY(length > 0);
|
||||
packets.append(QByteArray(reinterpret_cast<const char*>(encoded), length));
|
||||
}
|
||||
publish(video, packets, 3);
|
||||
return packets;
|
||||
};
|
||||
#ifdef TEST_NULL_AUDIO
|
||||
QTest::qWait(20);
|
||||
for (unsigned batch = 0; batch < 8; batch++) { publish({}, audioPackets(), 0); uasync_poll(ua, 0); }
|
||||
QTest::qWait(200);
|
||||
QCOMPARE(shown.count(), 0);
|
||||
QCOMPARE(nonzeroSamples.load(), uint64_t(0));
|
||||
#endif
|
||||
QTimer sender;
|
||||
connect(&sender, &QTimer::timeout, this, [this, video, &audioPackets] {
|
||||
publish(video, audioPackets(), 3);
|
||||
});
|
||||
sender.start(100);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(shown.count() > 0, 5000);
|
||||
|
||||
Reference in new issue
Block a user