aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Simoncelli <federico.simoncelli@gmail.com>2014-01-05 13:04:46 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-05 18:44:18 +0100
commitb53d6ce3fdefb48b4844efc1572b8ae9da0c4ecc (patch)
tree8a1863b11a9d9f6bf2592a94291fa80d316c01ad
parentb13d6c837fd70e494279a50f6bf7c40f43842f6a (diff)
downloadffmpeg-b53d6ce3fdefb48b4844efc1572b8ae9da0c4ecc.tar.gz
pulse: get latency only when needed
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavdevice/pulse_audio_dec.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libavdevice/pulse_audio_dec.c b/libavdevice/pulse_audio_dec.c
index 38f2ad0fd3..3b5cebb7f6 100644
--- a/libavdevice/pulse_audio_dec.c
+++ b/libavdevice/pulse_audio_dec.c
@@ -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;
}