Date [DD/MM/YY] | Comment | Version |
---|---|---|
29/07/23 | First Release | 1.0.0 |
AV Sync
- Audio Video SynchronizationHAL
- Hardware Abstraction LayerAPI
- Application Programming InterfaceCaller
- Any user of the interface via the APIsSoC
- System on ChipIOCTL
- Input-Output ControlAV Sync
HAL
provides an interface between the caller
and SoC
for audio and video synchronization in real time. The picture below shows the interactions between Caller
, AV Sync
HAL
and SoC
AV Sync
.
AV Sync
module is a software component that enables synchronization between audio and video frames in real-time media applications. This module is particularly important in media playback scenarios where the audio and video streams faces synchronization issues.
These requirements ensure that the HAL
executes correctly within the run-time environment that it will be used in. Failure to meet these requirements will likely result in undefined and unexpected behaviour.
Caller
must initialize the AV Sync
session by calling avsync_soc_init()
before calling any other API
.
This interface is not required to be thread safe. Any caller
while invoking these HAL APIs
must ensure calls are made in a thread safe manner.
The interface is expected to support a single instantiation with a single process.
This interface will own any memory that it creates and will also be responsible to free. The caller
will own the memory that it creates.
This interface is not required to be involved in power management.
avsync_soc_free_frame_callback()
sets the callback function for freeing any allocated video frames and metadata.
This interface is required to have no blocking calls.
All the APIs
must return error synchronously as a return argument. HAL
is responsible for handling system errors (e.g. out of memory) internally.
There is no requirement for the interface to persist any setting information.
This interface is required to support DEBUG, INFO and ERROR messages. ERROR logs must be enabled by default. DEBUG and INFO is required to be disabled by default and enabled when needed.
This interface is required to not cause excessive memory and CPU utilization.
HAL
Tests will endeavour to create worst case scenarios to assist investigations.The HAL
implementation is expected to released under the Apache License 2.0.
The source code must build into a shared library and must be named as libXavsync.so where X denotes the SoC
AV Sync
module. The build mechanism must be independent of Yocto.
Any change to the interface must be reviewed and approved by component architects and owners.
The SoC
vendor must provide adequate platform customization for the implementation of this module.
API
documentation will be provided by Doxygen which will be generated from the header files.
The caller
is expected to have complete control over the life cycle of the HAL
.
Caller
will be calling the HAL
APIs
, which are responsible to call the respective SoC
specific AV Sync
APIs
, and that is further expected to handle the low-level synchronization related operations using IOCTL calls.HAL
using function avsync_soc_init()
before making any other API
calls. If this call fails, the HAL
must return the respective error. The caller
initializes the AV Sync
session with refresh rate and sync type to get session id, session.avsync_soc_free_frame_callback()
registers a callback function responsible for releasing video frame and metadata that is no longer required.AV Sync
module will be done using avsync_soc_push_frame()
and avsync_soc_pop_frame()
respectively. avsync_soc_set_interval()
is used to update the vblank interval.avsync_soc_pause()
and avsync_soc_eos()
must handle the playback conditions 'pause / resume' and 'end-of-stream' respectively.avsync_soc_set_mode()
, avsync_soc_set_rate()
and avsync_soc_set_interval()
respectively. avsync_soc_set_mode()
is used to set the sync mode that determines how the SoC
synchronizes the audio and video. Supported sync types are Video Master, Audio Master and Program Clock Reference Master. avsync_soc_set_rate()
will be called before avsync_soc_pause()
to check if the playback is in normal mode(1x) and is not already paused.AV Sync
session will be terminated using avsync_soc_term()
API
and must deallocate all the resources which are created by the avsync_soc_init()
.