Preserve desktop camera cadence under timestamp jitter
This commit is contained in:
1 parent
209f2ceb7c
commit
f3eed42c3f
3 files changed
+28
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#include "call_video_engine.h"
|
||||
#include "call_video_encoder.h"
|
||||
#include "call_video_decoder.h"
|
||||
#include "call_video_cadence.h"
|
||||
#include "../../../src/call/call_video_port.h"
|
||||
#include "../../../src/call/call_audio.h"
|
||||
#include "debug_config.h"
|
||||
@@ -174,7 +175,7 @@ void CallVideoEngine::transmit() {
|
||||
int64_t reportAt = nowUs(), encodeMax = 0;
|
||||
uint64_t captureBase = 0;
|
||||
unsigned encodedCount = 0, keyCount = 0, sendBusy = 0, paced = 0;
|
||||
int64_t pacedPts = -1;
|
||||
CallVideoCadence cadence;
|
||||
while (m->running) {
|
||||
struct call_video_port_status state{};
|
||||
if (call_video_port_status(m->id, &state) < 0) break;
|
||||
@@ -210,10 +211,6 @@ void CallVideoEngine::transmit() {
|
||||
}
|
||||
if (format.generation && state.have_peer && !call_video_format_supported(&caps, &state.peer, &format)) appliedRevision = 0;
|
||||
if (!enabled || !state.have_peer || pts <= lastPts) { idle(); continue; }
|
||||
if (lastPts >= 0 && pts - lastPts < 33333) {
|
||||
if (pacedPts != pts) { pacedPts = pts; ++paced; }
|
||||
idle(); continue;
|
||||
}
|
||||
if (revision != appliedRevision) {
|
||||
if (lastKey >= 0 && pts - lastKey < 1000000) { idle(); continue; }
|
||||
call_video_format next{format.generation + 1, (uint16_t)width, (uint16_t)height, 30, 0, (uint8_t)codec, 0, 4000000, 0};
|
||||
@@ -243,6 +240,7 @@ void CallVideoEngine::transmit() {
|
||||
call_video_port_applied(m->id, format.generation, request, 0);
|
||||
}
|
||||
#ifdef HAVE_STREAM_CAPTURE
|
||||
if (!cadence.accept(pts)) { lastPts = pts; ++paced; idle(); continue; }
|
||||
QImage image = raw.toImage();
|
||||
if (image.isNull()) { DEBUG_WARN(DEBUG_CATEGORY_CALL, "camera frame conversion failed"); lastPts = pts; continue; }
|
||||
LiveEncodedFrame output; CallVideoRateCompletion completion;
|
||||
|
||||
Reference in new issue
Block a user