- aout_buffer_t * p_buffer;
- int i_tmp, i_size;
- byte_t * p_bytes;
-
- if( !p_sys->b_initialized )
- {
- msleep( THREAD_SLEEP );
- continue;
- }
-
- /* Get the presentation date of the next write() operation. It
- * is equal to the current date + latency */
- p_buffer = aout_OutputNextBuffer( p_aout, mdate() + p_sys->latency, 0 );
-
- if ( p_buffer != NULL )
- {
- p_bytes = p_buffer->p_buffer;
- i_size = p_buffer->i_nb_bytes;
- }
- else
- {
- i_size = aout_FormatToByterate( &p_aout->output.output )
- * p_sys->i_size
- / p_aout->output.output.i_rate;
- p_bytes = alloca( i_size );
- memset( p_bytes, 0, i_size );
- }
-
- i_tmp = arts_write( p_sys->stream, p_bytes, i_size );
+ i_tmp = arts_write( p_sys->stream, p_buffer->p_buffer,
+ p_buffer->i_nb_bytes );