【问题标题】:what is size, in bytes, of .NET UWP MediaFrameReference frame.NET UWP MediaFrameReference 帧的大小(以字节为单位)是多少
【发布时间】:2018-10-11 01:52:55
【问题描述】:

在微软示例项目CameraFrames中,private void Reader_FrameArrived()读取的帧大小是多少?

以下是示例项目中的代码:

private void Reader_FrameArrived(MediaFrameReader sender, MediaFrameArrivedEventArgs args)
{
    // TryAcquireLatestFrame will return the latest frame that has not yet been acquired.
    // This can return null if there is no such frame, or if the reader is not in the
    // "Started" state. The latter can occur if a FrameArrived event was in flight
    // when the reader was stopped.
    using (var frame = sender.TryAcquireLatestFrame())
    {
        _frameRenderer.ProcessFrame(frame);
    }
}

什么是“帧”大小(以字节为单位)?

【问题讨论】:

  • 您是希望有一个单一的答案,还是在问如何通过代码发现这个数字?
  • 通过代码,如下面答案

标签: c# .net windows uwp


【解决方案1】:

试试Media​Frame​Reference.Buffer​Media​Frame.Buffer.Length

using (var frame = sender.TryAcquireLatestFrame())
{
    var length = frame.Buffer​Media​Frame.Buffer.Length;
    _frameRenderer.ProcessFrame(frame);
}

我在我的笔记本电脑上测试,值为 1228800(视频帧为 640x480,每像素 4 个字节)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-27
    • 2011-11-02
    • 2013-05-03
    • 1970-01-01
    • 1970-01-01
    • 2021-03-27
    相关资源
    最近更新 更多