DASH low latency
Low latency support is an end-to-end solution (meaning both the stream at the head-end and the player at the client side need to be configured for low latency). From the player client point of view, there are a few things to consider for low latency support:
The live playback start point (offset from the real live edge).
The playback position is kept close to the target live offset range as much as possible during playback. When playback is delayed, the player may increase playback speed to catch up with the live edge or decrease speed if the position is too close to the edge and at risk of buffer starvation.
The low latency DASH stream should define a ServiceDescription
element in the manifest to specify the target live offset, offset range, and playback speed range when the live offset is outside the expected offset range.
MPD-defined low latency values
The NAGRA Media Player is configured so that when it receives an MPD containing a DASH stream, it will search for the ServiceDescription
element to check if the provided MPD is from a low latency stream service.
<ServiceDescription id="0">
<Latency max="6000" min="2000" referenceId="0" target="4000" />
<PlaybackRate max="1.04" min="0.96" />
</ServiceDescription>
From this, the targetOffsetMs
, minOffsetMs
, maxOffsetMs
, minPlaybackSpeed
and maxPlaybackSpeed
variables within OTVPlayerConfiguration
will have their configuration values changed from their defaults to match the MPD. The player will use target offset as live playback start point (now - targetLiveOffset). If the live offset is greater than the maxOffset
, the player will adjust playback speed to above 1.0 to reduce the latency; if the live offset is smaller than the minOffset
, the player will adjust playback speed to less than 1.0 to increase the latency.
User-defined low latency values
The player provides APIs via OTVPlayerConfiguration
to allow the application to configure its live latency strategy that will override the setting from the stream's ServiceDescription
. In this case, the first thing to do is create a new OTVPlayerConfiguration.Builder
instance. By calling this, you create an OTVPlayerConfiuration
with the default values, which you can then change through methods such as setLiveTargetOffsetMs
, setLiveMinOffsetMs
, setLiveMaxOffsetMs
, setLiveMinPlaybackSpeed
and setLiveMaxPlaybackSpeed
. Once all changes are added, call the build()
method on your OTVPlayerConfiguration.Builder
and pass this value to OTVVideoView
with setPlayerConfiguration(OTVPlayerConfiguration config)
.
Make sure you call setPlayerConfiguration()
BEFORE you call setVideoPath()
, or your player is likely to be constructed with default values and not the values the user has altered.
Low latency default values
When constructing the OTVPlayerConfiguration
the default values of liveConfiguration
are unset, but there are these default values for liveSpeedControl
:
//live configuration
liveTargetOffsetMs = TIME_UNSET;
liveMinOffsetMs = TIME_UNSET;
liveMaxOffsetMs = TIME_UNSET;
liveMinPlaybackSpeed = RATE_UNSET;
liveMaxPlaybackSpeed = RATE_UNSET;
//live speed control
minUpdateIntervalMs = DefaultLivePlaybackSpeedControl.DEFAULT_MIN_UPDATE_INTERVAL_MS;//1000
proportionalControlFactor = DefaultLivePlaybackSpeedControl.DEFAULT_PROPORTIONAL_CONTROL_FACTOR;//0.1f
maxLiveOffsetErrorMsForUnitSpeed = DefaultLivePlaybackSpeedControl.DEFAULT_MAX_LIVE_OFFSET_ERROR_MS_FOR_UNIT_SPEED;//20
targetLiveOffsetIncrementOnRebufferMs = DefaultLivePlaybackSpeedControl.DEFAULT_TARGET_LIVE_OFFSET_INCREMENT_ON_REBUFFER_MS;//500
minPossibleLiveOffsetSmoothingFactor = DefaultLivePlaybackSpeedControl.DEFAULT_MIN_POSSIBLE_LIVE_OFFSET_SMOOTHING_FACTOR;//0.999f
Presentation Delay (live offset) and playback speed
If LiveConfiguration
has all its values unset, it will assume the application does not define a low latency strategy. If your stream does not have a ServiceDescription
element, the player will look up the suggestedPresentationDelay
element in the manifest.
If it is found, the player will try to use it as the live offset to determine the live playback start point.
If it is not found, the player will use three times the
videoSegmentDuration
as the live offset for the playback start point, and the player will use a constant playback speed of 1.0 to play the live stream.