媒体基础H264解码器无法正常工作 [英] media foundation H264 decoder not working properly

查看:359
本文介绍了媒体基础H264解码器无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用媒体基础创建一个视频会议的应用程序,我有一个问题解码我通过网络接收的H264视频帧。

I'm creating an application for video conferencing using media foundation and I'm having an issue decoding the H264 video frames I receive over the network.

设计

目前,我的网络源会对每个请求样本,除非有可用的存储样品。如果样本通过网络到达并且没有令牌可用,则样本被存储在链接列表中。否则,它将与MEMediaSample事件排队。我还将解码器设置为低延迟。

Currently my network source queues a token on every request sample, unless there is an available stored sample. If a sample arrives over the network and no token is available the sample is stored in a linked list. Otherwise it is queued with the MEMediaSample event. I also have the decoder set to low latency.

我的问题

使用我的网络源运行拓扑我立即看到呈现到屏幕的第一帧。然后,我经历一个漫长的停顿,直到一个直播开始播放完美。几秒钟后,流出现暂停,但是您注意到它只是循环通过相同的帧一遍又一遍添加在活框架每几秒钟,然后立即消失,并回到显示旧循环。

When running the topology using my network source I immediately see the first frame rendered to the screen. I then experience a long pause until a live stream begins to play perfectly. After a few seconds the stream appears to pause but then you notice that it's just looping through the same frame over and over again adding in a live frame every couple of seconds that then disappears immediately and goes back to displaying the old loop.

为什么会发生这种情况?我绝不是H264或媒体基金会的专家,但是,我一直在试图解决这个问题几个星期没有成功。我不知道问题可能在哪里。请帮帮我!

Why is this happening? I'm by no means an expert in H264 or media foundation for that matter but, I've been trying to fix this issue for weeks with no success. I have no idea where the problem might be. Please help me!

时间戳从0开始创建,并为每个新样本添加持续时间。其他数据从IMFSampleGrabberSinkCallback检索。

The time stamp is created by starting at 0 and adding the duration to it for every new sample. The other data is retrieved from a IMFSampleGrabberSinkCallback.

我也把一些MFTrace发布到msdn媒体基金会论坛链接

I've also posted some of my MFTrace onto the msdn media foundation forums Link

我提到,演示时钟似乎没有在跟踪上改变,但我不确定这是原因还是如何解决

I mentioned on there that the presentation clock doesn't seem to change on the trace but, I'm unsure if that's the cause or how to fix it.

推荐答案

编辑
您可以分享视频和完整的mftrace日志对于这个问题?我不清楚我真正发生了什么:你过一会儿看现场视频吗?

EDIT: Could you share the video and a full mftrace log for this issue? It's not clear for me what really happens: do you see the live video after a while?

当前日志不包含足够的信息来跟踪样本处理。从您的描述看起来像只有关键帧渲染。此外,呈现的关键帧的持续时间是奇怪的:

The current log does not contain enough information to trace sample processing. From your description is looks like that only keyframes are rendered. Plus, duration is weird for the rendered keyframe:

    Sample @00A74970, Time 6733ms, Duration 499ms. <- Duration is not 33ms.

我想看看该样本发生了什么。

I would like to see what happened to that sample.

在任何情况下,如果您使用标准编码器和解码器,问题应该是与您的媒体来源,以及如何缓冲帧。错误的循环缓冲区实现?您可能需要尝试并缓存一两个样本,然后才开始将其提供给解码器。

In any case, if you are using standard encoder and decoder, the issue should be with your media source, and how it buffers frames. Incorrect circular buffer implementation? You may want to try and cache a second or two of samples before starting giving them to the decoder.

这篇关于媒体基础H264解码器无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆