Merge pull request #35993 from akien-mga/who-let-the-latency-out
Workaround WebM playback bug after AudioServer latency fixes
This commit is contained in:
commit
6203c38fd1
@ -363,8 +363,10 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
float VideoStreamPlaybackTheora::get_time() const {
|
float VideoStreamPlaybackTheora::get_time() const {
|
||||||
|
// FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to
|
||||||
return time - AudioServer::get_singleton()->get_output_latency() - delay_compensation; //-((get_total())/(float)vi.rate);
|
// 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 {
|
Ref<Texture> VideoStreamPlaybackTheora::get_texture() const {
|
||||||
|
@ -393,17 +393,22 @@ int VideoStreamPlaybackWebm::get_mix_rate() const {
|
|||||||
|
|
||||||
inline bool VideoStreamPlaybackWebm::has_enough_video_frames() const {
|
inline bool VideoStreamPlaybackWebm::has_enough_video_frames() const {
|
||||||
if (video_frames_pos > 0) {
|
if (video_frames_pos > 0) {
|
||||||
|
// FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to
|
||||||
const double audio_delay = AudioServer::get_singleton()->get_output_latency();
|
// 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;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoStreamPlaybackWebm::should_process(WebMFrame &video_frame) {
|
bool VideoStreamPlaybackWebm::should_process(WebMFrame &video_frame) {
|
||||||
const double audio_delay = AudioServer::get_singleton()->get_output_latency();
|
// FIXME: AudioServer output latency was fixed in af9bb0e, previously it used to
|
||||||
return video_frame.time >= time + audio_delay + delay_compensation;
|
// 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() {
|
void VideoStreamPlaybackWebm::delete_pointers() {
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "audio_server.h"
|
#include "audio_server.h"
|
||||||
|
|
||||||
#include "core/io/resource_loader.h"
|
#include "core/io/resource_loader.h"
|
||||||
#include "core/os/file_access.h"
|
#include "core/os/file_access.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
@ -36,14 +37,11 @@
|
|||||||
#include "scene/resources/audio_stream_sample.h"
|
#include "scene/resources/audio_stream_sample.h"
|
||||||
#include "servers/audio/audio_driver_dummy.h"
|
#include "servers/audio/audio_driver_dummy.h"
|
||||||
#include "servers/audio/effects/audio_effect_compressor.h"
|
#include "servers/audio/effects/audio_effect_compressor.h"
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
|
|
||||||
#define MARK_EDITED set_edited(true);
|
#define MARK_EDITED set_edited(true);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define MARK_EDITED
|
#define MARK_EDITED
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AudioDriver *AudioDriver::singleton = NULL;
|
AudioDriver *AudioDriver::singleton = NULL;
|
||||||
@ -1405,8 +1403,6 @@ AudioServer::AudioServer() {
|
|||||||
mix_frames = 0;
|
mix_frames = 0;
|
||||||
channel_count = 0;
|
channel_count = 0;
|
||||||
to_mix = 0;
|
to_mix = 0;
|
||||||
output_latency = 0;
|
|
||||||
output_latency_ticks = 0;
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
prof_time = 0;
|
prof_time = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -240,9 +240,6 @@ private:
|
|||||||
|
|
||||||
Mutex *audio_data_lock;
|
Mutex *audio_data_lock;
|
||||||
|
|
||||||
float output_latency;
|
|
||||||
uint64_t output_latency_ticks;
|
|
||||||
|
|
||||||
void init_channels_and_buffers();
|
void init_channels_and_buffers();
|
||||||
|
|
||||||
void _mix_step();
|
void _mix_step();
|
||||||
|
Loading…
Reference in New Issue
Block a user