我听到使用 Graph Edit 创建的 DirectShow 图形发出咔嗒声,但我的电脑上的播放器软件可以流畅地播放音频
我有一个 DirectShow 应用程序,是用 Delphi 6 使用 DSPACK 组件库构建的。两天来我一直在尝试解决音频播放问题。当我运行我创建的过滤器图表时,我在播放中听到重复的点击声。真正令人困惑的是,我与过滤器图同时创建的音频文件具有干净的连续音频,而不是间隙。所以我知道音频缓冲区正在正确传输,但我正在做的事情是“堵塞”“实时”播放。或者说我是这么想的。我花了两天时间诊断问题,寻找信号量持有时间过长(锁定)或时间戳问题,我在另一篇 Stack Overflow 帖子中记录了这些问题:
尽管输出文件是,但在渲染 DirectShow 过滤器期间出现卡顿“smooth”
几分钟前,我决定尝试使用图形编辑实用程序进行测试。我创建了一个非常简单的图表,仅包含我正在使用的捕获设备(VOIP 电话麦克风)和我正在使用的渲染器设备(HD ATI 后置音频 输出到耳机)。总共两个过滤器。 令我惊讶的是,我听到了同样的咔哒声。所以这是一个根本不涉及我的代码的案例,我听到了咔哒声。
然后,我将图形编辑创建的过滤器图形中的音频渲染器更改为VOIP 电话耳机。咔哒声消失了。
现在我知道有一种方法可以在 ATI 后置音频设备上获得流畅的音频,因为它是首选音频输出设备,并且从我在 PC 上播放的视频到我在其上播放的波形文件,所有内容听起来都完美无缺。那么其他软件程序是否做了一些与连接过滤器不同的事情呢?我想知道 HD ATI 后置音频 的默认模式是否没有双缓冲,并且其他软件程序是否知道如何启用该功能?或者他们是否正在做其他事情,例如使用其他 DirectShow 或 DirectSound 过滤器或技术,以使音频在 HD ATI 后置音频 渲染器上流畅播放?
I have a DirectShow application that I built with Delphi 6 using the DSPACK component library. For two days I have been trying to solve a problem with audio playback. When I run the filter graph I create I hear repetitive clicks in the playback. What was really confusing was that the audio file I created simultaneously with my filter graph had clean continuous audio, not gaps. So I knew that the audio buffers were being delivered properly but something I was doing was "jamming up" the "live" playback. Or so I thought. I spent two days diagnosing the problem looking for semaphores being held too long (locks) or perhaps timestamp problems, which I documented in this other Stack Overflow post:
Getting stuttering during rendering of my DirectShow filter despite output file being "smooth"
A few minutes ago I decided to try a test with the Graph Edit utility. I created a dead simple graph consisting of just the capture device I was using (VOIP phone microphone), and the renderer device I was using (HD ATI Rear Audio output to headphones). Two filters total. Much to my surprise I heard the same clicking. So here was a case that did not involve my code at all and I heard clicking.
Then I changed the audio renderer in the Graph Edit created filter graph to the VOIP phone ear piece. The clicking went away.
Now I know there's a way to get smooth audio on ut the ATI Rear Audio device since its the preferred audio output device and everything from videos I play on my PC to wave files I play on it sound flawless. So are the other software programs doing something different than just connecting filters? I am wondering if perhaps the default mode for the HD ATI Rear Audio is without double-buffering and perhaps those other software programs know how to enable that feature? Or are they doing something else, perhaps using another DirectShow or DirectSound filter or technique for example, to make the audio play smoothly on the HD ATI Rear Audio renderer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能遇到的情况(尽管取决于实际的口吃)是,当您使用由不同硬件支持的捕获和播放设备时,它们的采样率略有不同。例如,您以 (22050 - 2%) Hz 的实际速率捕获 22050 Hz,并以 (22050 + 2%) Hz 的硬件消耗字节进行回放。
现在显然这不会顺利进行:最终播放将遇到数据低于...如果您保存到文件并从文件播放,它将变得顺利,因为文件将能够以播放设备的速率提供数据。如果捕获和回放设备是相同的硬件,则它们可能使用共享的“硬件”时钟和速率匹配。
该问题称为“速率匹配”,并在 MSDN 的 实时源部分。
What you possibly having (depends on actual stuttering though) is that when you are using capture and playback devices backed by different hardware, their sampling rates slightly differ. For example, you capture 22050 Hz at actual rate of (22050 - 2%) Hz and you play it back with hardware consuming bytes at (22050 + 2%) Hz.
Now obviously this won't work out smooth: eventually playback will experience data underlow... If you save into file and play back from file, it will go smooth as the file will be able to supply data at the rate of playback device. If capture and playback devices are the same hardware, they are likely to use shared "hardware" clock and rates match.
The problem is known as "rate matcing" and is discussed on MSDN in Live Sources section.