From dc2815373debd4f2a3c541ac9b818dbdc90072c8 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Thu, 15 May 2003 13:28:54 +0000 Subject: audio_out loop rely upon driver eventually blocking after a couple of writes. if not, we will be wasting cpu there. CVS patchset: 4849 CVS date: 2003/05/15 13:28:54 --- src/audio_out/audio_none_out.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/audio_out/audio_none_out.c b/src/audio_out/audio_none_out.c index f9c54073f..014114e5e 100644 --- a/src/audio_out/audio_none_out.c +++ b/src/audio_out/audio_none_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_none_out.c,v 1.1 2003/05/13 22:39:41 miguelfreitas Exp $ + * $Id: audio_none_out.c,v 1.2 2003/05/15 13:28:54 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -113,6 +113,14 @@ static int ao_none_get_gap_tolerance (ao_driver_t *this_gen) static int ao_none_write(ao_driver_t *this_gen, int16_t *data, uint32_t num_frames) { + none_driver_t *this = (none_driver_t *) this_gen; + + /* take some time to pretend we are doing something. + * avoids burning cpu. + */ + if( (1000 * num_frames / this->sample_rate) > 10 ) + xine_usec_sleep ((1000 * num_frames / this->sample_rate)*1000/2); + return 1; } -- cgit v1.2.3