mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
b=1014862 assert that source track resamplers are used with the correct channel count r=padenot
--HG-- extra : rebase_source : cc28665fc90cf0bfc9f113b5e25f2c57a4948c9e
This commit is contained in:
parent
229cf57fa4
commit
a1f60f3113
@ -178,6 +178,9 @@ public:
|
||||
void Resample(SpeexResamplerState* aResampler, uint32_t aInRate, uint32_t aOutRate)
|
||||
{
|
||||
mDuration = 0;
|
||||
#ifdef DEBUG
|
||||
uint32_t segmentChannelCount = ChannelCount();
|
||||
#endif
|
||||
|
||||
for (ChunkIterator ci(*this); !ci.IsEnded(); ci.Next()) {
|
||||
nsAutoTArray<nsTArray<T>, GUESS_AUDIO_CHANNELS> output;
|
||||
@ -190,6 +193,7 @@ public:
|
||||
continue;
|
||||
}
|
||||
uint32_t channels = c.mChannelData.Length();
|
||||
MOZ_ASSERT(channels == segmentChannelCount);
|
||||
output.SetLength(channels);
|
||||
bufferPtrs.SetLength(channels);
|
||||
uint32_t inFrames = c.mDuration;
|
||||
|
@ -2289,11 +2289,13 @@ SourceMediaStream::ResampleAudioToGraphSampleRate(TrackData* aTrackData, MediaSe
|
||||
return;
|
||||
}
|
||||
AudioSegment* segment = static_cast<AudioSegment*>(aSegment);
|
||||
if (!aTrackData->mResampler) {
|
||||
int channels = segment->ChannelCount();
|
||||
int channels = segment->ChannelCount();
|
||||
|
||||
// If this segment is just silence, we delay instanciating the resampler.
|
||||
if (channels) {
|
||||
// If this segment is just silence, we delay instanciating the resampler.
|
||||
if (channels) {
|
||||
if (aTrackData->mResampler) {
|
||||
MOZ_ASSERT(aTrackData->mResamplerChannelCount == segment->ChannelCount());
|
||||
} else {
|
||||
SpeexResamplerState* state = speex_resampler_init(channels,
|
||||
aTrackData->mInputRate,
|
||||
GraphImpl()->AudioSampleRate(),
|
||||
@ -2303,6 +2305,9 @@ SourceMediaStream::ResampleAudioToGraphSampleRate(TrackData* aTrackData, MediaSe
|
||||
return;
|
||||
}
|
||||
aTrackData->mResampler.own(state);
|
||||
#ifdef DEBUG
|
||||
aTrackData->mResamplerChannelCount = channels;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
segment->ResampleChunks(aTrackData->mResampler);
|
||||
|
@ -800,6 +800,9 @@ public:
|
||||
// Resampler if the rate of the input track does not match the
|
||||
// MediaStreamGraph's.
|
||||
nsAutoRef<SpeexResamplerState> mResampler;
|
||||
#ifdef DEBUG
|
||||
int mResamplerChannelCount;
|
||||
#endif
|
||||
TrackTicks mStart;
|
||||
// Each time the track updates are flushed to the media graph thread,
|
||||
// this is cleared.
|
||||
|
Loading…
Reference in New Issue
Block a user