Comments (1)
First,this is cozed by push data into amix filter not correctly(size must be equal sample_rate * sample_size per second).
According to Matthew van Eerde's blog,find a simple way to fix this,which is just render silent pcm data all the time,so the ready signal will be sent all time.
Here is the blog:
Playing silence via wasapi
WASAPI loopback capture
There are a couple of oddities for WASAPI loopback capture. One is that “event mode” doesn’t work for loopback capture; you can call pAudioClient->Initialize(… AUDCLNT_STREAMFLAGS_LOOPBACK | AUDCLNT_STREAMFLAGS_EVENTCALLBACK, … ), you can call pAudioClient->SetEventHandle(…), and everything will succeed… but the “data is ready” event will never fire. So this app creates its own waitable timer.
Another oddity is that WASAPI will only push data down to the render endpoint when there are active streams. When nothing is playing, there is nothing to capture.
For example, play a song, and then run loopback-capture. While loopback-capture is running, stop the song, and then start it again. You’ll get this output when you start it back up:
>loopback-capture Press Enter to quit... IAudioCaptureClient::GetBuffer set flags to 0x00000001 on pass 5381 after 1088829 frames Thread HRESULT is 0x8000ffff
The flag in question is AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY. When the song stopped, no more data was available to capture. Eventually the song started up again, and WASAPI dutifully reported that there was a glitch detected. This app stops on glitches.
There are a couple of other possible ways to handle this. One way is to ignore glitches; then if you stop a song, wait a few seconds, and start it again, then the recorded signal will omit the wait and abut the two “audio is playing” portions.
But my particular favorite way of handling this is to run silence.exe. That way there are never any “nothing is playing” glitches, because there’s always something playing.
from screen-recorder.
Related Issues (20)
- Get video encoders crashed when recording
- Pause HOT 1
- Audio capture under win7 HOT 1
- Micphone
- get db from pcm array
- get db from pcm array
- separate record and muxe HOT 1
- V2.0
- when my one pc, have two of three screen, whether it can record ? HOT 18
- 音频和视频编码的时候不需要比较下时间戳吗? HOT 12
- Does screen-recorder support recording based on one window or dialog(not based on desktop) please? HOT 3
- vaapi support? HOT 1
- video and audio is not sync HOT 12
- 程序崩溃 HOT 1
- Can not Play video HOT 1
- 为什么我录制出来帧率只有12 HOT 1
- 录出来的视频有杂音 (MacOS 11.5 QuickTime Player)
- 如何录制两份,比如一份直播用,一份录制本地
- Crashed when i use dxgi duplication to capture a rotate screen HOT 1
- Electron下WGC采集崩溃
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from screen-recorder.