зеркало из https://github.com/mozilla/gecko-dev.git
Bug 996853: handle AUDIO_FORMAT_SILENCE in MediaPipeline and AudioSegment::WriteTo r=roc
This commit is contained in:
Родитель
86f7e1e45e
Коммит
dd18e038e2
|
@ -175,7 +175,7 @@ AudioSegment::WriteTo(uint64_t aID, AudioStream* aOutput, AudioMixer* aMixer)
|
|||
// To avoid overbuffering in the AudioStream, we simply drop the silence,
|
||||
// here. The stream will underrun and output silence anyways.
|
||||
if (c.mBuffer || aOutput->GetWritten()) {
|
||||
if (c.mBuffer) {
|
||||
if (c.mBuffer && c.mBufferFormat != AUDIO_FORMAT_SILENCE) {
|
||||
channelData.SetLength(c.mChannelData.Length());
|
||||
for (uint32_t i = 0; i < channelData.Length(); ++i) {
|
||||
channelData[i] = c.mChannelData[i];
|
||||
|
|
|
@ -1010,6 +1010,9 @@ void MediaPipelineTransmit::PipelineListener::ProcessAudioChunk(
|
|||
ConvertAudioSamplesWithScale(buf, samples, chunk.mDuration, chunk.mVolume);
|
||||
}
|
||||
break;
|
||||
case AUDIO_FORMAT_SILENCE:
|
||||
memset(samples, 0, chunk.mDuration * sizeof(samples[0]));
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(PR_FALSE);
|
||||
return;
|
||||
|
@ -1017,9 +1020,7 @@ void MediaPipelineTransmit::PipelineListener::ProcessAudioChunk(
|
|||
}
|
||||
} else {
|
||||
// This means silence.
|
||||
for (uint32_t i = 0; i < chunk.mDuration; ++i) {
|
||||
samples[i] = 0;
|
||||
}
|
||||
memset(samples, 0, chunk.mDuration * sizeof(samples[0]));
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!(rate%100)); // rate should be a multiple of 100
|
||||
|
|
Загрузка…
Ссылка в новой задаче