PulseAudio Simple API exact timestamps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ffmpeg and libav are using the simple api. Please take a look at:

https://github.com/FFmpeg/FFmpeg/blob/master/libavdevice/pulse.c
https://github.com/libav/libav/blob/master/libavdevice/pulse.c

Unfortunately the audio sample rate is not synchronized to the wallclock.
For live streaming pulseaudio with another device like x11grab this is
quite essential.

Is there a way to get exact timestamps from pulse api?
How would the implementation look like?

peili

static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt)
{
    PulseData *pd  = s->priv_data;
    int res;
    pa_usec_t latency;

    *pkt->pts = GET EXACT TIMESTAMP (); // TODO*


    if (av_new_packet(pkt, pd->frame_size) < 0) {
        return AVERROR(ENOMEM);
    }

    if ((pa_simple_read(pd->s, pkt->data, pkt->size, &res)) < 0) {
        av_log(s, AV_LOG_ERROR, "pa_simple_read failed: %s\n",
               pa_strerror(res));
        av_free_packet(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);
    }




    return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20130926/f93d9aff/attachment.html>


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux