update ffmpeg_speaker
This commit is contained in:
parent
057984f440
commit
9284d52c46
@ -348,11 +348,11 @@ void ffmpegSpeaker::play_audio_() {
|
||||
//音频数据队列为空且解码已经结束,退出
|
||||
if (!state_.is_decoding) {
|
||||
if (pcm_handle_) {
|
||||
// 停止播放,清空缓存,否则结束会有杂音
|
||||
snd_pcm_drop(pcm_handle_);
|
||||
LOG(INFO) << "[ffmpegSpeaker] ALSA buffer cleared";
|
||||
break;
|
||||
snd_pcm_drain(pcm_handle_);
|
||||
snd_pcm_close(pcm_handle_);
|
||||
pcm_handle_ = nullptr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
this_thread::sleep_for(chrono::seconds(1)); // 空队列等待
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user