AAMP HLS Architecture Overview
Created on June 21, 2022
HLS
- While presenting normal-rate content, a software demuxer is used to extract PTS from Audio and Video elementary streams. This can be disabled at runtime using aamp.cfg.
- PCR is smaller than PTS. PCR is used as a BasePTS normally, but if difference between PCR and first PTS exceeds 500ms, we instead use PTS-500ms as BasePTS. Software Demuxer subtracts BasePTS and uses this as timestamp for elementary streams.
-
- Normally, for QAM transmission, PCR is used as base pts for audio and video. PCR is used to do clock synchronization with the headend, so client clock is the same as PCR. Once clock reaches PTS of an elementary stream, the elementary stream is presented. To ensure enough buffering for QAM, PTS to PCR difference is big.
- For IP, this is not required since we are downloading entire fragments. Only base timestamp common to both audio and video is required. There addresses a field issue where playback after trickmode was taking a long time with AAMP’s gstreamer pipeline compared to AVE. This is fixed by clamping the diff between BasePTS and first PTS to 500ms.
- While presenting iframes for TrickPlay, AAMP’s software demuxer does not modify timestamps. Instead they are is calculated in the fragment collector taking into account desired play rate (trick speed) and frames per seconds (smoothness). Re-timestamping is done, but it not done in software demux. Here presentation timestamps from TS are not used, but fragment start time from the manifest and rate are used to calculate a final PTS. Updated position is calculated by: updatedPosition = m_startPosition + (position – m_startPosition) / m_playRate; where m_startPosition is position of first es injected.
- Primary reason for using s/w demuxer (leveraging code used with QAM RMF player) is to eliminate channel change delay manifesting as a freeze in playersinkbin. Production content .ts fragments contain video concatenated (not interleaved) with audio. With BCOM demuxer, we see video freeze before it starts moving. With SW demuxer, full motion video presents immediately. Other advantages are:
-
- if audio track is elementary stream as in the case of Sling, there is no easy way we can do A/V synchronization using playersinkbin.
- Playersinkbin reserves audio decoder which can cause issues.
- Software demux gives more control related to timestamping.
- Portability – less exposure to platform-specific gstreamer bugs/idiosyncrasies
Go To Top