[alsa-devel] Getting played tsms in ALSA

Irfan Shaikh irfan.shaikh at sasken.com
Fri Aug 19 11:39:12 CEST 2011

Hello all

                  At setup time, when we create alsa handle and get the pcm_status object from it.

snd_pcm_status *status;
At run time:
snd_timestamp_t timestamp = {0};
snd_pcm_status(pcm_handle, status);
snd_pcm_status_get_tstamp(status, &timestamp);
print timestamp.tv_sec and timestamp.tv_usec

Here when we start first instance, timestamp.tv_sec goes incrementing as we play as expected.
But we when shutdown (destroy alsa handle, re-init) , the timestamps increase from the same point.
i.e if we stopped playback at time x secs, the next instance starts showing the time from x secs.
The time reported by snd_pcm_status_get_tstamp() resets after we reboot the board.

Another observation is that when we have two instances. We start the first instance , pause it after x secs.
And then start the next instance, the time given by ALSA again starts at x secs.

I think the snd_pcm_get_tstamp should be handle based but it seems it's not the case.

How can we reset the timestamp values ?


SASKEN BUSINESS DISCLAIMER: This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email.
Read Disclaimer at http://www.sasken.com/extras/mail_disclaimer.html

More information about the Alsa-devel mailing list