[gegl/video-rejuvenation: 30/83] ui: tweak low latency audio playback
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/video-rejuvenation: 30/83] ui: tweak low latency audio playback
- Date: Thu, 19 Nov 2015 21:44:51 +0000 (UTC)
commit 91ed68b7c281c83353ba00871c51a70c181d1526
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Oct 24 00:16:13 2015 +0200
ui: tweak low latency audio playback
bin/mrg-ui.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/bin/mrg-ui.c b/bin/mrg-ui.c
index 37b756c..9081287 100644
--- a/bin/mrg-ui.c
+++ b/bin/mrg-ui.c
@@ -81,8 +81,8 @@ static void sdl_audio_cb(void *udata, Uint8 *stream, int len)
static void sdl_add_audio_sample (int sample_pos, float left, float right)
{
- audio_data[audio_len/2 + 0] = left * 32767.0;
- audio_data[audio_len/2 + 1] = right * 32767.0;
+ audio_data[audio_len/2 + 0] = left * 32767.0 * 0.66;
+ audio_data[audio_len/2 + 1] = right * 32767.0 * 0.66;
audio_len += 4;
if (audio_len >= AUDIO_BUF_LEN)
@@ -348,7 +348,7 @@ static void open_audio (int frequency)
spec.freq = frequency;
spec.format = AUDIO_S16SYS;
spec.channels = 2;
- spec.samples = 1024;
+ spec.samples = 127;
spec.callback = sdl_audio_cb;
SDL_OpenAudio(&spec, 0);
@@ -1018,14 +1018,15 @@ static void gegl_ui (Mrg *mrg, void *data)
o->scale,
o->render_quality);
+ if (o->is_video)
{
GeglAudio *audio = NULL;
gdouble fps;
- if (o->is_video)
- {
- gegl_node_get (o->load, "audio", &audio, "frame-rate", &fps, NULL);
- if (audio && audio->samples > 0)
+ gegl_node_get (o->load, "audio", &audio, "frame-rate", &fps, NULL);
+ if (audio)
{
+ if (audio->samples > 0)
+ {
int i;
if (!audio_started)
{
@@ -1041,10 +1042,9 @@ static void gegl_ui (Mrg *mrg, void *data)
while ( (audio_post / 4.0) / audio->samplerate < (o->frame_no / fps) - 0.05 )
{
g_usleep (100); /* sync audio */
+ }
}
-
- g_object_unref (audio);
- }
+ g_object_unref (audio);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]