mirror of https://github.com/odrling/Aegisub
Add workaround for what looks like a ffmpeg bug
Originally committed to SVN as r2194.
This commit is contained in:
parent
74913197fb
commit
d65b697e12
|
@ -122,8 +122,15 @@ LAVCAudioProvider::LAVCAudioProvider(Aegisub::String _filename)
|
|||
|
||||
resample_ratio = (float)sample_rate / (float)codecContext->sample_rate;
|
||||
}
|
||||
|
||||
double length = (double)stream->duration * av_q2d(stream->time_base);
|
||||
|
||||
/* libavcodec seems to give back invalid stream length values for Matroska files.
|
||||
* As a workaround, we can use the overall file length.
|
||||
*/
|
||||
double length;
|
||||
if(stream->duration == AV_NOPTS_VALUE)
|
||||
length = (double)lavcfile->fctx->duration / AV_TIME_BASE;
|
||||
else
|
||||
length = (double)stream->duration * av_q2d(stream->time_base);
|
||||
num_samples = (int64_t)(length * sample_rate);
|
||||
|
||||
buffer = (int16_t *)malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
||||
|
|
Loading…
Reference in New Issue