Change validity checks to assert statements.
This commit is contained in:
parent
afa013f4bf
commit
50535b07c3
|
@ -588,24 +588,15 @@ void XmaContext::DecodePackets(XMA_CONTEXT_DATA* data) {
|
||||||
// Copy to the output buffer.
|
// Copy to the output buffer.
|
||||||
size_t written_bytes = 0;
|
size_t written_bytes = 0;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// Validity checks.
|
// Validity checks.
|
||||||
if (decoded_frame_->nb_samples > kSamplesPerFrame) {
|
assert(decoded_frame_->nb_samples <= kSamplesPerFrame);
|
||||||
XELOGAPU("Decoded frame has an invalid sample count!");
|
assert(context_->sample_fmt == AV_SAMPLE_FMT_FLTP);
|
||||||
return;
|
|
||||||
} else if (context_->sample_fmt != AV_SAMPLE_FMT_FLTP) {
|
|
||||||
XELOGAPU("libav decoder did not output floating point samples!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check the returned buffer size.
|
// Check the returned buffer size.
|
||||||
if (av_samples_get_buffer_size(NULL, context_->channels,
|
assert(av_samples_get_buffer_size(NULL, context_->channels,
|
||||||
decoded_frame_->nb_samples,
|
decoded_frame_->nb_samples,
|
||||||
context_->sample_fmt, 1) !=
|
context_->sample_fmt, 1) ==
|
||||||
context_->channels * decoded_frame_->nb_samples * sizeof(float)) {
|
context_->channels * decoded_frame_->nb_samples * sizeof(float));
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Convert the frame.
|
// Convert the frame.
|
||||||
ConvertFrame((const uint8_t**)decoded_frame_->data, context_->channels,
|
ConvertFrame((const uint8_t**)decoded_frame_->data, context_->channels,
|
||||||
|
|
Loading…
Reference in New Issue