summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authoruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-14 04:17:41 +0000
committeruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-14 04:17:41 +0000
commite978f405a1b071cf8f15e718e2bb010f6272059f (patch)
tree9be51d3ac062b1a957de32336647f5e474ed2380 /mplayer.c
parentb65c295b31a49bd44eac66f212f29deafb1600a5 (diff)
downloadmpv-e978f405a1b071cf8f15e718e2bb010f6272059f.tar.bz2
mpv-e978f405a1b071cf8f15e718e2bb010f6272059f.tar.xz
Try filling audio buffers more if they're very large, add some comments.
Larger buffers could make sense with lots of high-bitrate audio channels. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20906 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/mplayer.c b/mplayer.c
index f8ce952db9..a376ad61d0 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2923,23 +2923,30 @@ int fill_audio_out_buffers(void)
int playsize;
int playflags=0;
int audio_eof=0;
+ int bytes_to_write;
current_module="play_audio";
while (1) {
+ // all the current uses of ao_data.pts seem to be in aos that handle
+ // sync completely wrong; there should be no need to use ao_data.pts
+ // in get_space()
ao_data.pts = ((sh_video?sh_video->timer:0)+sh_audio->delay)*90000.0;
- playsize = audio_out->get_space();
+ bytes_to_write = audio_out->get_space();
+ if (sh_video || bytes_to_write >= ao_data.outburst)
+ break;
// handle audio-only case:
- if (playsize < ao_data.outburst && !sh_video) {
- // this is where mplayer sleeps during audio-only playback
- // to avoid 100% CPU use
- usec_sleep(10000); // Wait a tick before retry
- continue;
- }
+ // this is where mplayer sleeps during audio-only playback
+ // to avoid 100% CPU use
+ usec_sleep(10000); // Wait a tick before retry
+ }
+ while (bytes_to_write) {
+ playsize = bytes_to_write;
if (playsize > MAX_OUTBURST)
playsize = MAX_OUTBURST;
+ bytes_to_write -= playsize;
// Fill buffer if needed:
current_module="decode_audio";
@@ -2972,6 +2979,11 @@ int fill_audio_out_buffers(void)
// play audio:
current_module="play_audio";
+
+ // Is this pts value actually useful for the aos that access it?
+ // They're obviously badly broken in the way they handle av sync;
+ // would not having access to this make them more broken?
+ ao_data.pts = ((sh_video?sh_video->timer:0)+sh_audio->delay)*90000.0;
playsize = audio_out->play(sh_audio->a_out_buffer, playsize, playflags);
if (playsize > 0) {
@@ -2986,7 +2998,6 @@ int fill_audio_out_buffers(void)
mp_msg(MSGT_CPLAYER, MSGL_WARN, "Audio output truncated at end.\n");
sh_audio->a_out_buffer_len = 0;
}
- break;
}
return 1;
}