Bug 1027713 - Part 5 - Trigger the panning logic on stream creation. r=jesup

UpdateStreamOrder is not called often because it's expensive (it's called only
when the graph topology changed), and it's earlier in the MSG loop than the
audio stream creation, so we need to tell the newly created AudioStream that a
microphone is active on creation as well.

The panning logic is also now triggered on stream start, because it is async.
This commit is contained in:
Paul Adenot 2014-07-24 17:05:24 +02:00
parent 9944fe8ee3
commit d826143a22
2 changed files with 7 additions and 0 deletions

View File

@ -573,6 +573,7 @@ void AudioStream::PanOutputIfNeeded(bool aMicrophoneActive)
if (!strcmp(device->output_name, "ispk")) {
// Pan everything to the right speaker.
if (aMicrophoneActive) {
LOG(("%p Panning audio output to the right.", this));
if (cubeb_stream_set_panning(mCubebStream, 1.0) != CUBEB_OK) {
NS_WARNING("Could not pan audio output to the right.");
}
@ -877,11 +878,14 @@ AudioStream::StartUnlocked()
mNeedsStart = true;
return;
}
if (mState == INITIALIZED) {
int r;
{
MonitorAutoUnlock mon(mMonitor);
r = cubeb_stream_start(mCubebStream);
PanOutputIfNeeded(mMicrophoneActive);
}
mState = r == CUBEB_OK ? STARTED : ERRORED;
LOG(("AudioStream: started %p, state %s", this, mState == STARTED ? "STARTED" : "ERRORED"));

View File

@ -960,6 +960,9 @@ MediaStreamGraphImpl::CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTim
AudioStream::LowLatency);
audioOutputStream->mTrackID = tracks->GetID();
// If there is a mixer, there is a micrphone active.
audioOutputStream->mStream->SetMicrophoneActive(mMixer);
LogLatency(AsyncLatencyLogger::AudioStreamCreate,
reinterpret_cast<uint64_t>(aStream),
reinterpret_cast<int64_t>(audioOutputStream->mStream.get()));