WPF MediaElement 视频播放撕裂 [英] WPF MediaElement video playback tearing

查看:30
本文介绍了WPF MediaElement 视频播放撕裂的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 WPF 中的 MediaElement 控件来播放视频.它在 Vista 中运行良好,但是当我在 XP 机器上运行它时,我的显示屏出现撕裂现象.看起来好像没有使用垂直同步,只是更新屏幕中间绘制.

I'm trying to use the MediaElement control in WPF to play back video. It works great in Vista, but when I run it on an XP machine I get tearing in the display. It looks as if it's not using the vertical synch, and just updating the screen mid-draw.

有人知道如何解决这个问题吗?

Anyone know how to fix this problem?

推荐答案

与 Vista 相比,这与 WPF 在 XP 下呈现到屏幕的方式有关.在 Vista 下,应用程序渲染到屏幕外缓冲区,然后与其他已更改的窗口合成,并由名为 DWM.exe 的进程以适当的时间间隔呈现在屏幕上.这可以(并且可能确实)将 WPF 的窗口更新呈现到与刷新间隔同步的视频缓冲区.

This has more to do with the way WPF renders to the screen under XP compared to Vista. Under Vista, apps render to an offscreen buffer which is then composited with other windows that have changed and is presented to the screen at the appropriate intervals by a process called DWM.exe. That can (and presumably does) present WPF's window updates to the video buffer synchronized with the refresh interval.

在 XP 上,WPF 使用 DirextX 直接渲染到屏幕并在需要时更新视频缓冲区.可能有一些方法可以让它与刷新间隔同步,但我没有研究它,因为我不再使用 XP.

On XP WPF uses DirextX to render straight to the screen and updates the video buffer whenever it wants to. There might be some way to get it to synchronise with the refresh interval, but I haven't looked into it because I don't use XP any more.

这篇关于WPF MediaElement 视频播放撕裂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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