Bug 1189506. Fix multi-track MediaStream audio output. r=karlt

--HG--
extra : commitid : 4dgdSqpqKqg
extra : rebase_source : 1aa877cd02cfb224d71480af781393a4199e4232
This commit is contained in:
Robert O'Callahan 2015-09-04 17:58:26 +12:00
Родитель 1d3ba86e8a
Коммит 244a142843
1 изменённых файлов: 11 добавлений и 12 удалений

Просмотреть файл

@ -815,24 +815,23 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream,
{
MOZ_ASSERT(mRealtime, "Should only attempt to play audio in realtime mode");
StreamTime ticksWritten = 0;
// We compute the number of needed ticks by converting a difference of graph
// time rather than by substracting two converted stream time to ensure that
// the rounding between {Graph,Stream}Time and track ticks is not dependant
// on the absolute value of the {Graph,Stream}Time, and so that number of
// ticks to play is the same for each cycle.
StreamTime ticksNeeded = aTo - aFrom;
if (aStream->mAudioOutputStreams.IsEmpty()) {
return 0;
}
float volume = 0.0f;
for (uint32_t i = 0; i < aStream->mAudioOutputs.Length(); ++i) {
volume += aStream->mAudioOutputs[i].mVolume;
}
StreamTime ticksWritten = 0;
for (uint32_t i = 0; i < aStream->mAudioOutputStreams.Length(); ++i) {
ticksWritten = 0;
// We compute the number of needed ticks by converting a difference of graph
// time rather than by subtracting two converted stream times to ensure that
// the rounding between {Graph,Stream}Time and track ticks is not dependant
// on the absolute value of the {Graph,Stream}Time, and so that number of
// ticks to play is the same for each cycle.
StreamTime ticksNeeded = aTo - aFrom;
MediaStream::AudioOutputStream& audioOutput = aStream->mAudioOutputStreams[i];
StreamBuffer::Track* track = aStream->mBuffer.FindTrack(audioOutput.mTrackID);
AudioSegment* audio = track->Get<AudioSegment>();