diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-05-15 13:28:54 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-05-15 13:28:54 +0000 |
commit | dc2815373debd4f2a3c541ac9b818dbdc90072c8 (patch) | |
tree | 3857f22a57d5e2a86b89f9e2ca1f3ff970a72dd1 | |
parent | 6d3eb02b8b26a519967debe0c4b363c796735cb1 (diff) | |
download | xine-lib-dc2815373debd4f2a3c541ac9b818dbdc90072c8.tar.gz xine-lib-dc2815373debd4f2a3c541ac9b818dbdc90072c8.tar.bz2 |
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
-rw-r--r-- | src/audio_out/audio_none_out.c | 10 |
1 files changed, 9 insertions, 1 deletions
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; } |