如何使用媒体源扩展(MSE)低延迟模式

问题描述 投票:1回答:1

我读到MSE有这种low-latency模式,为解码提供零缓冲。无论这可能带来不稳定的性能,理论上它在用于实时流时应该提供更低的延迟。有人知道触发这个low-latency模式的“技巧”吗?

参考:https://blog.parsecgaming.com/game-streaming-tech-in-the-browser-with-parsec-5b70d0f359bc

video-streaming html5-video webrtc live-streaming media-source
1个回答
2
投票

这不是一个完整的答案,因为我自己就是在学习。似乎Chromium正在使用来自MP4流的提示来确定是否应该使用低延迟模式。

video_renderer_impl.cc

bool ShouldUseLowDelayMode(DemuxerStream* stream) {
  return base::FeatureList::IsEnabled(kLowDelayVideoRenderingOnLiveStream) &&
         stream->liveness() == DemuxerStream::LIVENESS_LIVE;
}

然后在mp4_stream_parser.cc

// In ISO/IEC 14496-12:2005(E), 8.30.2: ".. If an MP4 file is created in
// real-time, such as used in live streaming, it is not likely that the
// fragment_duration is known in advance and this (mehd) box may be
// omitted."

// We have an unknown duration (neither any mvex fragment_duration nor moov
// duration value indicated a known duration, above.)

// TODO(wolenetz): Investigate gating liveness detection on timeline_offset
// when it's populated. See http://crbug.com/312699
params.liveness = DemuxerStream::LIVENESS_LIVE;

因此,如果您可以生成没有持续时间的流,则会假定它是实时的,并且将使用低延迟模式。

还有一些关于暴露未来触发低延迟模式而不进行流修改的机制的讨论:https://github.com/w3c/media-source/issues/21

© www.soinside.com 2019 - 2024. All rights reserved.