mirror of https://github.com/odrling/Aegisub
fix retarded breakage in previous commit.
Originally committed to SVN as r2304.
This commit is contained in:
parent
d1c62c1324
commit
bf931df635
|
@ -152,11 +152,8 @@ LAVCAudioProvider::LAVCAudioProvider(Aegisub::String _filename)
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
throw _T("ffmpeg audio provider: Failed to allocate audio decoding buffer, out of memory?");
|
throw _T("ffmpeg audio provider: Failed to allocate audio decoding buffer, out of memory?");
|
||||||
|
|
||||||
overshoot_buffer = (int16_t *)malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
|
||||||
if (!overshoot_buffer)
|
|
||||||
throw _T("ffmpeg audio provider: Failed to allocate audio decoding buffer, out of memory?");
|
|
||||||
|
|
||||||
leftover_samples = 0;
|
leftover_samples = 0;
|
||||||
|
last_output_sample = -1;
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
Destroy();
|
Destroy();
|
||||||
|
@ -174,8 +171,6 @@ void LAVCAudioProvider::Destroy()
|
||||||
{
|
{
|
||||||
if (buffer)
|
if (buffer)
|
||||||
free(buffer);
|
free(buffer);
|
||||||
if (overshoot_buffer)
|
|
||||||
free(overshoot_buffer);
|
|
||||||
if (rsct)
|
if (rsct)
|
||||||
audio_resample_close(rsct);
|
audio_resample_close(rsct);
|
||||||
if (codecContext)
|
if (codecContext)
|
||||||
|
@ -188,6 +183,12 @@ void LAVCAudioProvider::GetAudio(void *buf, int64_t start, int64_t count)
|
||||||
{
|
{
|
||||||
int16_t *_buf = (int16_t *)buf;
|
int16_t *_buf = (int16_t *)buf;
|
||||||
|
|
||||||
|
/* this exception disabled for now */
|
||||||
|
/* if (last_output_sample != start-1)
|
||||||
|
throw _T("ffmpeg audio provider: nonlinear access attempted, try loading audio to RAM or HD cache"); */
|
||||||
|
|
||||||
|
last_output_sample += count;
|
||||||
|
|
||||||
int64_t samples_to_decode = (num_samples - start) * channels; /* samples left to the end of the stream */
|
int64_t samples_to_decode = (num_samples - start) * channels; /* samples left to the end of the stream */
|
||||||
if (count < samples_to_decode) /* haven't reached the end yet, so just decode the requested number of samples */
|
if (count < samples_to_decode) /* haven't reached the end yet, so just decode the requested number of samples */
|
||||||
samples_to_decode = count * channels; /* times the number of channels */
|
samples_to_decode = count * channels; /* times the number of channels */
|
||||||
|
|
|
@ -76,6 +76,8 @@ private:
|
||||||
int16_t *buffer;
|
int16_t *buffer;
|
||||||
int16_t *overshoot_buffer;
|
int16_t *overshoot_buffer;
|
||||||
|
|
||||||
|
int64_t last_output_sample;
|
||||||
|
|
||||||
int leftover_samples;
|
int leftover_samples;
|
||||||
|
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
Loading…
Reference in New Issue