Commit b53d6ce3 authored by Federico Simoncelli's avatar Federico Simoncelli Committed by Michael Niedermayer

pulse: get latency only when needed

Signed-off-by: 's avatarFederico Simoncelli <fsimonce@redhat.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent b13d6c83
......@@ -109,7 +109,6 @@ static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt)
{
PulseData *pd = s->priv_data;
int res;
pa_usec_t latency;
if (av_new_packet(pkt, pd->frame_size) < 0) {
return AVERROR(ENOMEM);
......@@ -122,13 +121,15 @@ static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EIO);
}
if ((latency = pa_simple_get_latency(pd->s, &res)) == (pa_usec_t) -1) {
av_log(s, AV_LOG_ERROR, "pa_simple_get_latency() failed: %s\n",
pa_strerror(res));
return AVERROR(EIO);
}
if (pd->pts == AV_NOPTS_VALUE) {
pa_usec_t latency;
if ((latency = pa_simple_get_latency(pd->s, &res)) == (pa_usec_t) -1) {
av_log(s, AV_LOG_ERROR, "pa_simple_get_latency() failed: %s\n",
pa_strerror(res));
return AVERROR(EIO);
}
pd->pts = -latency;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment