mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
Try to prevent superfluous calls to recording functions
if not necessary
This commit is contained in:
parent
1386476792
commit
eea1b3790b
@ -488,9 +488,9 @@ void audio_driver_set_nonblocking_state(bool enable)
|
||||
**/
|
||||
static bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
{
|
||||
struct resampler_data src_data;
|
||||
static struct retro_perf_counter resampler_proc = {0};
|
||||
static struct retro_perf_counter audio_convert_s16 = {0};
|
||||
struct resampler_data src_data;
|
||||
const void *output_data = NULL;
|
||||
unsigned output_frames = 0;
|
||||
size_t output_size = sizeof(float);
|
||||
@ -502,7 +502,8 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
src_data.output_frames = 0;
|
||||
src_data.ratio = 0.0f;
|
||||
|
||||
recording_push_audio(data, samples);
|
||||
if (recording_data)
|
||||
recording_push_audio(data, samples);
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) || settings->audio.mute_enable)
|
||||
return true;
|
||||
|
@ -1114,7 +1114,7 @@ static bool video_driver_frame_filter(const void *data,
|
||||
data, width, height, pitch);
|
||||
performance_counter_stop(&softfilter_process);
|
||||
|
||||
if (settings->video.post_filter_record)
|
||||
if (settings->video.post_filter_record && recording_data)
|
||||
recording_dump_frame(video_driver_state_buffer,
|
||||
*output_width, *output_height, *output_pitch);
|
||||
|
||||
@ -1147,7 +1147,7 @@ bool video_driver_cached_frame(void)
|
||||
void *recording = recording_driver_get_data_ptr();
|
||||
|
||||
/* Cannot allow recording when pushing duped frames. */
|
||||
recording_driver_clear_data_ptr();
|
||||
recording_data = NULL;
|
||||
|
||||
/* Not 100% safe, since the library might have
|
||||
* freed the memory, but no known implementations do this.
|
||||
@ -1161,7 +1161,7 @@ bool video_driver_cached_frame(void)
|
||||
|
||||
core_frame(&info);
|
||||
|
||||
recording_driver_set_data_ptr(recording);
|
||||
recording_data = recording;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2090,8 +2090,8 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
!video_driver_state_filter
|
||||
|| !settings->video.post_filter_record
|
||||
|| !data
|
||||
|| video_driver_has_gpu_record()
|
||||
)
|
||||
|| video_driver_record_gpu_buffer
|
||||
) && recording_data
|
||||
)
|
||||
recording_dump_frame(data, width, height, pitch);
|
||||
|
||||
|
@ -52,7 +52,7 @@ static bool recording_enable = false;
|
||||
static bool recording_use_output_dir = false;
|
||||
|
||||
static const record_driver_t *recording_driver = NULL;
|
||||
static void *recording_data = NULL;
|
||||
void *recording_data = NULL;
|
||||
|
||||
/**
|
||||
* record_driver_find_ident:
|
||||
@ -187,9 +187,6 @@ void recording_dump_frame(const void *data, unsigned width,
|
||||
{
|
||||
struct ffemu_video_data ffemu_data = {0};
|
||||
|
||||
if (!recording_data)
|
||||
return;
|
||||
|
||||
ffemu_data.pitch = pitch;
|
||||
ffemu_data.width = width;
|
||||
ffemu_data.height = height;
|
||||
@ -283,9 +280,6 @@ void recording_push_audio(const int16_t *data, size_t samples)
|
||||
{
|
||||
struct ffemu_audio_data ffemu_data;
|
||||
|
||||
if (!recording_data)
|
||||
return;
|
||||
|
||||
ffemu_data.data = data;
|
||||
ffemu_data.frames = samples / 2;
|
||||
|
||||
|
@ -180,6 +180,8 @@ unsigned *recording_driver_get_height(void);
|
||||
|
||||
void recording_driver_free_state(void);
|
||||
|
||||
extern void *recording_data;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user