ros-drivers / audio_common

Common code for working with audio in ROS
BSD 3-Clause "New" or "Revised" License
86 stars 151 forks source link

get capture audio stamp from gstreamer in real recording #220

Closed v4hn closed 1 year ago

v4hn commented 1 year ago

This implementation works well for me and does not change behavior when combined with a simulator.

knorth55 commented 1 year ago

I learnt a bit about gstreamer clocking now. https://gstreamer.freedesktop.org/documentation/application-development/advanced/clocks.html?gi-language=c https://gstreamer.freedesktop.org/documentation/gstreamer/gstbuffer.html?gi-language=c

base-time: The timestamp when the the pipleline state goes into PLAYING state (Absolute time) pts: The timestamp when the buffer should be presented to user (Relative time from base-time) So the timestamp should be base-time + pts, and this PR calculates that.

v4hn commented 1 year ago

yeah, the gstreamer documentation is excessive, but also hard to parse... Took me some time to figure out the API and I eventually found a very recent almost-correct stackoverflow post (which I fail to find again right now).

knorth55 commented 1 year ago

Gstreamer is made by genius and also made for genius, I think. That is why the documentation is huge but hard to learn whole part. Anyway, I will check this PR on my laptop and merge this.

knorth55 commented 1 year ago

@v4hn thank you for your contribution!