@ -3086,10 +3086,16 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
} else {
} else {
/* FIXME: which device to read from? */
/* FIXME: which device to read from? */
if ( ! list_empty ( & out - > pcm_dev_list ) ) {
if ( ! list_empty ( & out - > pcm_dev_list ) ) {
struct pcm_device * pcm_device ;
struct listnode * node ;
unsigned int avail ;
unsigned int avail ;
struct pcm_device * pcm_device = node_to_item ( list_head ( & out - > pcm_dev_list ) ,
struct pcm_device , stream_list_node ) ;
list_for_each ( node , & out - > pcm_dev_list ) {
pcm_device = node_to_item ( node ,
struct pcm_device ,
stream_list_node ) ;
if ( pcm_device - > pcm ! = NULL ) {
if ( pcm_get_htimestamp ( pcm_device - > pcm , & avail , timestamp ) = = 0 ) {
if ( pcm_get_htimestamp ( pcm_device - > pcm , & avail , timestamp ) = = 0 ) {
size_t kernel_buffer_size = out - > config . period_size * out - > config . period_count ;
size_t kernel_buffer_size = out - > config . period_size * out - > config . period_count ;
int64_t signed_frames = out - > written - kernel_buffer_size + avail ;
int64_t signed_frames = out - > written - kernel_buffer_size + avail ;
@ -3102,11 +3108,16 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
if ( signed_frames > = 0 ) {
if ( signed_frames > = 0 ) {
* frames = signed_frames ;
* frames = signed_frames ;
ret = 0 ;
ret = 0 ;
goto done ;
}
ret = - 1 ;
}
}
}
}
}
}
}
}
}
done :
pthread_mutex_unlock ( & out - > lock ) ;
pthread_mutex_unlock ( & out - > lock ) ;
return ret ;
return ret ;