mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-05-05 06:20:43 +09:00
Fix mixed audio messed up because of sleep in mutex lock
This commit is contained in:
@@ -3287,6 +3287,7 @@ int main(int argc, char **argv) {
|
|||||||
amix_thread = std::thread([&]() {
|
amix_thread = std::thread([&]() {
|
||||||
AVFrame *aframe = av_frame_alloc();
|
AVFrame *aframe = av_frame_alloc();
|
||||||
while(running) {
|
while(running) {
|
||||||
|
{
|
||||||
std::lock_guard<std::mutex> lock(audio_filter_mutex);
|
std::lock_guard<std::mutex> lock(audio_filter_mutex);
|
||||||
for(AudioTrack &audio_track : audio_tracks) {
|
for(AudioTrack &audio_track : audio_tracks) {
|
||||||
if(!audio_track.sink)
|
if(!audio_track.sink)
|
||||||
@@ -3306,6 +3307,7 @@ int main(int argc, char **argv) {
|
|||||||
audio_track.pts += audio_track.codec_context->frame_size;
|
audio_track.pts += audio_track.codec_context->frame_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
av_usleep(5 * 1000); // 5 milliseconds
|
av_usleep(5 * 1000); // 5 milliseconds
|
||||||
}
|
}
|
||||||
av_frame_free(&aframe);
|
av_frame_free(&aframe);
|
||||||
|
|||||||
Reference in New Issue
Block a user