From e61d333297d61f7ff051c05687e032204fdfdcd5 Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Sat, 22 Mar 2008 22:45:46 +0000 Subject: [PATCH] warn the user if audio skew is likely Originally committed to SVN as r2115. --- aegisub/audio_provider_lavc.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/aegisub/audio_provider_lavc.cpp b/aegisub/audio_provider_lavc.cpp index a3a8e4f7d..a46941e43 100644 --- a/aegisub/audio_provider_lavc.cpp +++ b/aegisub/audio_provider_lavc.cpp @@ -196,14 +196,16 @@ void LAVCAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) we should do something about it, not pretend that everything's OK. -Fluff */ decoded_samples = audio_resample(rsct, _buf, buffer, decoded_samples / codecContext->channels); - /* make sure we somehow didn't end up with more samples than we wanted */ - assert(decoded_samples <= samples_to_decode); + /* make some noise if we somehow ended up with more samples than we wanted (will cause audio skew) */ + if (decoded_samples <= samples_to_decode) + wxLogMessage(wxString::Format(_T("Warning: decoder output more samples than requested, audio skew highly likely! (Wanted %d, got %d)"), samples_to_decode, decoded_samples)); } else { /* no resampling needed, just copy to the buffer */ /* if (decoded_samples > samples_to_decode) decoded_samples = samples_to_decode; */ - /* I do not understand the point of the above, changed to a more reasonable assertation instead -Fluff */ - assert(decoded_samples <= samples_to_decode); + /* I do not understand the point of the above -Fluff */ + if (decoded_samples <= samples_to_decode) + wxLogMessage(wxString::Format(_T("Warning: decoder output more samples than requested, audio skew highly likely! (Wanted %d, got %d)"), samples_to_decode, decoded_samples)); memcpy(_buf, buffer, temp_output_buffer_size); }