mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
fix latency reporting for oss and alsa modules
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1645 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
06f2799d8f
commit
45e495499e
3 changed files with 15 additions and 13 deletions
|
|
@ -217,17 +217,18 @@ static int mmap_write(struct userdata *u) {
|
|||
|
||||
static pa_usec_t sink_get_latency(struct userdata *u) {
|
||||
pa_usec_t r = 0;
|
||||
snd_pcm_status_t *status;
|
||||
snd_pcm_sframes_t frames = 0;
|
||||
int err;
|
||||
|
||||
snd_pcm_status_alloca(&status);
|
||||
|
||||
pa_assert(u);
|
||||
|
||||
snd_pcm_avail_update(u->pcm_handle);
|
||||
|
||||
if ((err = snd_pcm_delay(u->pcm_handle, &frames)) < 0) {
|
||||
if ((err = snd_pcm_status(u->pcm_handle, status)) < 0)
|
||||
pa_log("Failed to get delay: %s", snd_strerror(err));
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
frames = snd_pcm_status_get_delay(status);
|
||||
|
||||
if (frames > 0)
|
||||
r = pa_bytes_to_usec(frames * u->frame_size, &u->sink->sample_spec);
|
||||
|
|
@ -356,7 +357,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
|
|||
|
||||
*((pa_usec_t*) data) = r;
|
||||
|
||||
break;
|
||||
return 0;
|
||||
}
|
||||
|
||||
case PA_SINK_MESSAGE_SET_STATE:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue