Remove hardcoded 44100 samplerate

This commit is contained in:
Benau 2017-04-05 15:43:47 +08:00
parent bb529c011e
commit 391d31659b
2 changed files with 8 additions and 2 deletions

View File

@ -139,8 +139,8 @@ namespace Recorder
fwrite(&frame_size, 1, sizeof(uint32_t), vb_data);
fwrite(&last_timestamp, 1, sizeof(int64_t), vb_data);
fwrite(op.packet, 1, frame_size, vb_data);
double s =
(double)op.granulepos / 44100. * 1000000000.;
double s = (double)op.granulepos /
(double)ved->m_sample_rate * 1000000000.;
last_timestamp = (int64_t)s;
}
}

View File

@ -198,6 +198,12 @@ namespace Recorder
Log::error("WasapiRecorder", "Unsupported audio input format");
return NULL;
}
if (ved.m_sample_rate > 48000)
{
Log::error("WasapiRecorder", "Only support maximum 48000hz sample "
"rate audio.");
return NULL;
}
HRESULT hr = g_wasapi_data.m_client->Reset();
if (FAILED(hr))
{