Bug 932845 - Support hints for non gUM mediastreams. r=jesup

This commit is contained in:
Suhas 2013-12-08 21:44:32 -05:00
parent 51715eb475
commit 7b99f9f628
2 changed files with 27 additions and 3 deletions

View File

@ -1763,7 +1763,29 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded)
}
OutputMediaStream* out = mOutputStreams.AppendElement();
#ifdef DEBUG
// Estimate hints based on the type of the media element
// under the preference media.capturestream_hints for the
// debug builds only. This allows WebRTC Peer Connection
// to behave appropriately when media streams generated
// via mozCaptureStream*() are added to the Peer Connection.
// This functionality is planned to be used as part of Audio
// Quality Performance testing for WebRTC.
// Bug932845: Revisit this once hints mechanism is dealt with
// holistically.
uint8_t hints = 0;
if (Preferences::GetBool("media.capturestream_hints.enabled")) {
nsCOMPtr<nsIDOMHTMLVideoElement> video = do_QueryObject(this);
if (video && GetVideoFrameContainer()) {
hints = DOMMediaStream::HINT_CONTENTS_VIDEO | DOMMediaStream::HINT_CONTENTS_AUDIO;
} else {
hints = DOMMediaStream::HINT_CONTENTS_AUDIO;
}
}
out->mStream = DOMMediaStream::CreateTrackUnionStream(window, hints);
#else
out->mStream = DOMMediaStream::CreateTrackUnionStream(window);
#endif
nsRefPtr<nsIPrincipal> principal = GetCurrentPrincipal();
out->mStream->CombineWithPrincipal(principal);
out->mFinishWhenEnded = aFinishWhenEnded;

View File

@ -758,9 +758,11 @@ void MediaPipelineTransmit::PipelineListener::ProcessAudioChunk(
if (chunk.mBuffer) {
switch (chunk.mBufferFormat) {
case AUDIO_FORMAT_FLOAT32:
MOZ_MTLOG(ML_ERROR, "Can't process audio except in 16-bit PCM yet");
MOZ_ASSERT(PR_FALSE);
return;
{
const float* buf = static_cast<const float *>(chunk.mChannelData[0]);
ConvertAudioSamplesWithScale(buf, static_cast<int16_t*>(samples),
chunk.mDuration, chunk.mVolume);
}
break;
case AUDIO_FORMAT_S16:
{