[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9966: Make the resampler output buf
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9966: Make the resampler output buffer even-sized (as it's being considered an array of int16); don't abort if the samples-based computation of output buffer doesn't match the input one, as EmbeddedSoundTest.swf shows a case in which it fails but doesn't trigger any invalid write (using valgrind). |
Date: |
Wed, 08 Oct 2008 17:19:19 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9966
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2008-10-08 17:19:19 +0200
message:
Make the resampler output buffer even-sized (as it's being considered an
array of int16); don't abort if the samples-based computation of output buffer
doesn't match the input one, as EmbeddedSoundTest.swf shows a case in which it
fails but doesn't trigger any invalid write (using valgrind).
modified:
libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
=== modified file 'libmedia/ffmpeg/AudioDecoderFfmpeg.cpp'
--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp 2008-10-08 14:13:08 +0000
+++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp 2008-10-08 15:19:19 +0000
@@ -393,21 +393,28 @@
int samples = stereo ? outSize >> 2 : outSize >> 1;
int resampledFrameSize = int(std::ceil(outSize*resampleFactor));
+ // Make it an even number as it's going to be considered an array of
int16..
+ if ( resampledFrameSize&0x01 ) ++resampledFrameSize;
// Allocate just the required amount of bytes
boost::uint8_t* resampledOutput = new
boost::uint8_t[resampledFrameSize];
#ifdef GNASH_DEBUG_AUDIO_DECODING
log_debug("Calling the resampler; "
- "ouput to 44100hz, 2channels; "
- "input is %dhz, %dchannels",
- _audioCodecCtx->sample_rate, _audioCodecCtx->channels);
+ "ouput to 44100hz, 2channels, %dbytes; "
+ "input is %dhz, %dchannels, %dbytes, %dsamples",
+ resampledFrameSize, _audioCodecCtx->sample_rate,
+ _audioCodecCtx->channels, outSize, samples);
#endif
samples = _resampler.resample(outPtr, // input
reinterpret_cast<boost::int16_t*>(resampledOutput), //
output
samples); // input..
+#ifdef GNASH_DEBUG_AUDIO_DECODING
+ log_debug("resampler returned %d samples ", samples);
+#endif
+
// make sure to set outPtr *after* we use it as input to the
resampler
outPtr = reinterpret_cast<boost::int16_t*>(resampledOutput);
delete [] output;
@@ -427,7 +434,7 @@
log_debug(" output samples: %d", samples);
/// Memory errors...
- abort();
+ //abort();
}
// we let the consistency check run before we override outSize
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9966: Make the resampler output buffer even-sized (as it's being considered an array of int16); don't abort if the samples-based computation of output buffer doesn't match the input one, as EmbeddedSoundTest.swf shows a case in which it fails but doesn't trigger any invalid write (using valgrind).,
Sandro Santilli <=