diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-08 15:36:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-08 15:36:50 +0100 |
commit | 6203c38fd12c8aff26ea2e6d689f2d9b8ff1e0d0 (patch) | |
tree | 878a44119601e6a748bc12599b17410e2ee3378e /modules | |
parent | 3a5f45a6d14bfa35202d1611625eae23d052311b (diff) | |
parent | da411d1625a92e4c100bcda2c29709014e261ec9 (diff) |
Merge pull request #35993 from akien-mga/who-let-the-latency-out
Workaround WebM playback bug after AudioServer latency fixes
Diffstat (limited to 'modules')
-rw-r--r-- | modules/theora/video_stream_theora.cpp | 6 | ||||
-rw-r--r-- | modules/webm/video_stream_webm.cpp | 15 |
2 files changed, 14 insertions, 7 deletions
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index cf1fc3f175..00c7e87568 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -363,8 +363,10 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { }; float VideoStreamPlaybackTheora::get_time() const { - - return time - AudioServer::get_singleton()->get_output_latency() - delay_compensation; //-((get_total())/(float)vi.rate); + // FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to + // systematically return 0. Now that it gives a proper latency, it broke this + // code where the delay compensation likely never really worked. + return time - /* AudioServer::get_singleton()->get_output_latency() - */ delay_compensation; }; Ref<Texture> VideoStreamPlaybackTheora::get_texture() const { diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 41f9e67672..2763d30bb5 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -393,17 +393,22 @@ int VideoStreamPlaybackWebm::get_mix_rate() const { inline bool VideoStreamPlaybackWebm::has_enough_video_frames() const { if (video_frames_pos > 0) { - - const double audio_delay = AudioServer::get_singleton()->get_output_latency(); + // FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to + // systematically return 0. Now that it gives a proper latency, it broke this + // code where the delay compensation likely never really worked. + //const double audio_delay = AudioServer::get_singleton()->get_output_latency(); const double video_time = video_frames[video_frames_pos - 1]->time; - return video_time >= time + audio_delay + delay_compensation; + return video_time >= time + /* audio_delay + */ delay_compensation; } return false; } bool VideoStreamPlaybackWebm::should_process(WebMFrame &video_frame) { - const double audio_delay = AudioServer::get_singleton()->get_output_latency(); - return video_frame.time >= time + audio_delay + delay_compensation; + // FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to + // systematically return 0. Now that it gives a proper latency, it broke this + // code where the delay compensation likely never really worked. + //const double audio_delay = AudioServer::get_singleton()->get_output_latency(); + return video_frame.time >= time + /* audio_delay + */ delay_compensation; } void VideoStreamPlaybackWebm::delete_pointers() { |