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

Zip*_*Zip 6 video-streaming live-streaming html5-video webrtc media-source

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

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

Bra*_*rad 6

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

在video_renderer_impl.cc 中:

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

然后在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;
Run Code Online (Sandbox Code Playgroud)

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

还有一些关于在未来公开一种机制来触发无需流修改的低延迟模式的讨论:https : //github.com/w3c/media-source/issues/21