diff --git a/aegisub/audio_provider_lavc.cpp b/aegisub/audio_provider_lavc.cpp index 53feb2eba..fae96febf 100644 --- a/aegisub/audio_provider_lavc.cpp +++ b/aegisub/audio_provider_lavc.cpp @@ -85,7 +85,7 @@ LAVCAudioProvider::LAVCAudioProvider(Aegisub::String _filename) } #endif audStream = -1; - for (int i = 0; i < lavcfile->fctx->nb_streams; i++) { + for (int i = 0; i < (int)lavcfile->fctx->nb_streams; i++) { codecContext = lavcfile->fctx->streams[i]->codec; if (codecContext->codec_type == CODEC_TYPE_AUDIO) { stream = lavcfile->fctx->streams[i]; @@ -190,20 +190,14 @@ void LAVCAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) /* do we need to resample? */ if (rsct) { - /* if ((int64_t)(decoded_samples * resample_ratio / codecContext->channels) > samples_to_decode) - decoded_samples = (int64_t)(samples_to_decode / resample_ratio * codecContext->channels); */ - /* what is the point of the above? if we ended up with more samples than we wanted, - we should do something about it, not pretend that everything's OK. -Fluff */ + /* do the actual resampling */ decoded_samples = audio_resample(rsct, _buf, buffer, decoded_samples / codecContext->channels); /* 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)"), (int)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 -Fluff */ + /* no resampling needed, just copy to the buffer, but first make noise if we got an overflow */ 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)"), (int)samples_to_decode, decoded_samples)); diff --git a/aegisub/video_provider_lavc.cpp b/aegisub/video_provider_lavc.cpp index b1c5286ee..2cfb0df7c 100644 --- a/aegisub/video_provider_lavc.cpp +++ b/aegisub/video_provider_lavc.cpp @@ -98,7 +98,7 @@ void LAVCVideoProvider::LoadVideo(Aegisub::String filename, double fps) { // Find video stream vidStream = -1; codecContext = NULL; - for (int i=0;ifctx->nb_streams;i++) { + for (int i=0; i < (int)lavcfile->fctx->nb_streams; i++) { codecContext = lavcfile->fctx->streams[i]->codec; if (codecContext->codec_type == CODEC_TYPE_VIDEO) { stream = lavcfile->fctx->streams[i];