End vorbis encoder thread more properly

This commit is contained in:
Benau 2017-04-02 10:36:21 +08:00
parent ab2ce24914
commit adf889a885

View File

@ -79,7 +79,8 @@ namespace Recorder
pthread_cond_t* cond_request = ved->m_enc_request; pthread_cond_t* cond_request = ved->m_enc_request;
ogg_packet op; ogg_packet op;
int64_t last_timestamp = 0; int64_t last_timestamp = 0;
while (true) bool eos = false;
while (eos == false)
{ {
audio_data->lock(); audio_data->lock();
bool waiting = audio_data->getData().empty(); bool waiting = audio_data->getData().empty();
@ -93,7 +94,8 @@ namespace Recorder
audio_data->unlock(); audio_data->unlock();
if (audio_buf == NULL) if (audio_buf == NULL)
{ {
break; vorbis_analysis_wrote(&vd, 0);
eos = true;
} }
else else
{ {