]> git.alsa-project.org Git - alsa-plugins.git/commit
aaf: Implement Playback mode support
authorAndre Guedes <andre.guedes@intel.com>
Thu, 25 Oct 2018 01:11:12 +0000 (18:11 -0700)
committerJaroslav Kysela <perex@perex.cz>
Thu, 25 Oct 2018 06:09:02 +0000 (08:09 +0200)
commit83c604a4a94a5f08ea1869ff5017b7a9f1d4f375
treedd7e029e42556af9ecdac18f5dc782bc8aa4cde6
parenta6f720b9d55fdb27efc9ed4bbcaf3cdd44ad7072
aaf: Implement Playback mode support

This patch implements the playback mode support from the AAF plugin.
Simply put, this mode works as follows: PCM samples provided by alsa-lib
layer are encapsulated into AVTPDUs and transmitted through the network.
In summary, the playback mode implements a typical AVTP Talker.

When the AAF device is put in running state, its media clock is started.
At every tick from the media clock, audio frames are consumed from the
audio buffer, encapsulated into an AVTPDU, and transmitted to the
network. The presentation time from each AVTPDU is calculated taking in
consideration the maximum transit time and time uncertainty values
configured by the user.

Below follows some discussion about implementation details:

AVTP protocol doesn't support all formats and rates available in ALSA so
the plugin sets some constraints to ensure only supported configurations
are used (see aaf_set_hw_constraint function).

The plugin implements a media clock which is the source from AVTP
timestamps. The AVTP timestamp is based on PTP time which uses
International Atomic Time (TAI) coordinate system. The media clock is
implemented through a periodic timer using timerfd infrastructure so the
plugin requires that system clock and PTP clock are synchronized
(instructions on how to sync these clocks are provided in doc/aaf.txt).
CLOCK_TAI clockid isn't currently supported by timerfd so the timer fd
is created using CLOCK_REALTIME and the start time is converted from TAI
to UTC.

Even though only one file descriptor is used to implement the playback
mode, this patch doesn't leverage ioplug->poll_fd but defines poll
callbacks instead. The reason is these callbacks will be required to
support capture mode (to be implemented by upcoming patch).

The TSN data plane interface is the AF_PACKET socket family so the
plugin uses an AF_PACKET socket to send/receive AVTPDUs. Linux requires
CAP_NET_RAW capability in order to open an AF_PACKET socket so the
application that instantiates the plugin must have it. For further info
about AF_PACKET socket family see packet(7).

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
aaf/pcm_aaf.c
configure.ac
doc/aaf.txt