mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-04-19 08:25:48 +09:00
Better handle pausing with missing audio frames
This commit is contained in:
17
src/main.cpp
17
src/main.cpp
@@ -2296,6 +2296,16 @@ int main(int argc, char **argv) {
|
||||
|
||||
const double this_audio_frame_time = clock_get_monotonic_seconds() - paused_time_offset;
|
||||
|
||||
if(paused) {
|
||||
if(got_audio_data)
|
||||
received_audio_time = this_audio_frame_time;
|
||||
|
||||
if(!audio_device.sound_device.handle)
|
||||
usleep(timeout_ms * 1000);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
int ret = av_frame_make_writable(audio_device.frame);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Failed to make audio frame writable\n");
|
||||
@@ -2313,13 +2323,6 @@ int main(int argc, char **argv) {
|
||||
if(got_audio_data)
|
||||
received_audio_time = this_audio_frame_time;
|
||||
|
||||
if(paused) {
|
||||
received_audio_time = this_audio_frame_time;
|
||||
if(!audio_device.sound_device.handle)
|
||||
usleep(timeout_ms * 1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Jesus is there a better way to do this? I JUST WANT TO KEEP VIDEO AND AUDIO SYNCED HOLY FUCK I WANT TO KILL MYSELF NOW.
|
||||
// THIS PIECE OF SHIT WANTS EMPTY FRAMES OTHERWISE VIDEO PLAYS TOO FAST TO KEEP UP WITH AUDIO OR THE AUDIO PLAYS TOO EARLY.
|
||||
// BUT WE CANT USE DELAYS TO GIVE DUMMY DATA BECAUSE PULSEAUDIO MIGHT GIVE AUDIO A BIG DELAYED!!!
|
||||
|
||||
Reference in New Issue
Block a user