aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-04-09 23:34:35 +0200
committerdec05eba <dec05eba@protonmail.com>2024-04-09 23:34:35 +0200
commite7aa4a549951a4989f2a1506f891540dc1bc72c1 (patch)
treedfc60ad96bed8f929a667a3bb9a6ae95e974af30
parentd5bf41fed6628083200370cd5acf3ff43b592891 (diff)
Better audio timing test: compensate for audio server latency
-rw-r--r--TODO5
-rw-r--r--src/main.cpp4
2 files changed, 8 insertions, 1 deletions
diff --git a/TODO b/TODO
index 9b107d2..86911c3 100644
--- a/TODO
+++ b/TODO
@@ -113,4 +113,7 @@ Modify ffmpeg to accept opengl texture for nvenc encoding. Removes extra buffers
When vulkan encode is added, mention minimum nvidia driver required. (550.54.14?).
-Support drm plane rotation. Neither X11 nor any Wayland compositor currently rotates drm planes so this might not be needed. \ No newline at end of file
+Support drm plane rotation. Neither X11 nor any Wayland compositor currently rotates drm planes so this might not be needed.
+
+Investigate if there is a way to do gpu->gpu copy directly without touching system ram to enable video encoding on a different gpu. On nvidia this is possible with cudaMemcpyPeer, but how about from an intel/amd gpu to an nvidia gpu or the other way around or any combination of iGPU and dedicated GPU?
+ Maybe something with clEnqueueMigrateMemObjects? on AMD something with DirectGMA maybe?
diff --git a/src/main.cpp b/src/main.cpp
index 167f8a5..bb54ca2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2388,6 +2388,10 @@ int main(int argc, char **argv) {
double received_audio_time = clock_get_monotonic_seconds();
const int64_t timeout_ms = std::round((1000.0 / (double)audio_track.codec_context->sample_rate) * 1000.0);
+ // Move audio back by around 252 ms. This is just a shitty way to handle audio latency but pulseaudio latency calculation
+ // returns much lower value which isn't helpful.
+ audio_device.frame->pts = audio_track.codec_context->frame_size * 12;
+
while(running) {
void *sound_buffer;
int sound_buffer_size = -1;