mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 694814: Patch 6 - Change gUM prefs to media.getusermedia.*, groundwork for in-call changes r=jib
This commit is contained in:
parent
0d309498a3
commit
87719de66a
@ -379,13 +379,30 @@ class nsDOMUserMediaStream : public DOMLocalMediaStream
|
||||
{
|
||||
public:
|
||||
static already_AddRefed<nsDOMUserMediaStream>
|
||||
CreateTrackUnionStream(nsIDOMWindow* aWindow, uint32_t aHintContents)
|
||||
CreateTrackUnionStream(nsIDOMWindow* aWindow,
|
||||
MediaEngineSource *aAudioSource,
|
||||
MediaEngineSource *aVideoSource)
|
||||
{
|
||||
nsRefPtr<nsDOMUserMediaStream> stream = new nsDOMUserMediaStream();
|
||||
stream->InitTrackUnionStream(aWindow, aHintContents);
|
||||
DOMMediaStream::TrackTypeHints hints =
|
||||
(aAudioSource ? DOMMediaStream::HINT_CONTENTS_AUDIO : 0) |
|
||||
(aVideoSource ? DOMMediaStream::HINT_CONTENTS_VIDEO : 0);
|
||||
|
||||
nsRefPtr<nsDOMUserMediaStream> stream = new nsDOMUserMediaStream(aAudioSource);
|
||||
stream->InitTrackUnionStream(aWindow, hints);
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
nsDOMUserMediaStream(MediaEngineSource *aAudioSource) :
|
||||
mAudioSource(aAudioSource),
|
||||
mEchoOn(true),
|
||||
mAgcOn(false),
|
||||
mNoiseOn(true),
|
||||
mEcho(webrtc::kEcDefault),
|
||||
mAgc(webrtc::kAgcDefault),
|
||||
mNoise(webrtc::kNsDefault),
|
||||
mPlayoutDelay(20)
|
||||
{}
|
||||
|
||||
virtual ~nsDOMUserMediaStream()
|
||||
{
|
||||
Stop();
|
||||
@ -415,6 +432,21 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void
|
||||
AudioConfig(bool aEchoOn, uint32_t aEcho,
|
||||
bool aAgcOn, uint32_t aAgc,
|
||||
bool aNoiseOn, uint32_t aNoise,
|
||||
int32_t aPlayoutDelay)
|
||||
{
|
||||
mEchoOn = aEchoOn;
|
||||
mEcho = aEcho;
|
||||
mAgcOn = aAgcOn;
|
||||
mAgc = aAgc;
|
||||
mNoiseOn = aNoiseOn;
|
||||
mNoise = aNoise;
|
||||
mPlayoutDelay = aPlayoutDelay;
|
||||
}
|
||||
|
||||
virtual void RemoveDirectListener(MediaStreamDirectListener *aListener) MOZ_OVERRIDE
|
||||
{
|
||||
if (mSourceStream) {
|
||||
@ -437,6 +469,14 @@ public:
|
||||
// explicitly destroyed too.
|
||||
nsRefPtr<SourceMediaStream> mSourceStream;
|
||||
nsRefPtr<MediaInputPort> mPort;
|
||||
nsRefPtr<MediaEngineSource> mAudioSource; // so we can turn on AEC
|
||||
bool mEchoOn;
|
||||
bool mAgcOn;
|
||||
bool mNoiseOn;
|
||||
uint32_t mEcho;
|
||||
uint32_t mAgc;
|
||||
uint32_t mNoise;
|
||||
uint32_t mPlayoutDelay;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -517,6 +557,12 @@ public:
|
||||
NS_IMETHOD
|
||||
Run()
|
||||
{
|
||||
int32_t aec = (int32_t) webrtc::kEcUnchanged;
|
||||
int32_t agc = (int32_t) webrtc::kAgcUnchanged;
|
||||
int32_t noise = (int32_t) webrtc::kNsUnchanged;
|
||||
bool aec_on = false, agc_on = false, noise_on = false;
|
||||
int32_t playout_delay = 0;
|
||||
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
nsPIDOMWindow *window = static_cast<nsPIDOMWindow*>
|
||||
(nsGlobalWindow::GetInnerWindowWithId(mWindowID));
|
||||
@ -529,19 +575,39 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Create a media stream.
|
||||
DOMMediaStream::TrackTypeHints hints =
|
||||
(mAudioSource ? DOMMediaStream::HINT_CONTENTS_AUDIO : 0) |
|
||||
(mVideoSource ? DOMMediaStream::HINT_CONTENTS_VIDEO : 0);
|
||||
#ifdef MOZ_WEBRTC
|
||||
// Right now these configs are only of use if webrtc is available
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);
|
||||
|
||||
if (branch) {
|
||||
branch->GetBoolPref("media.getusermedia.aec_enabled", &aec_on);
|
||||
branch->GetIntPref("media.getusermedia.aec", &aec);
|
||||
branch->GetBoolPref("media.getusermedia.agc_enabled", &agc_on);
|
||||
branch->GetIntPref("media.getusermedia.agc", &agc);
|
||||
branch->GetBoolPref("media.getusermedia.noise_enabled", &noise_on);
|
||||
branch->GetIntPref("media.getusermedia.noise", &noise);
|
||||
branch->GetIntPref("media.getusermedia.playout_delay", &playout_delay);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Create a media stream.
|
||||
nsRefPtr<nsDOMUserMediaStream> trackunion =
|
||||
nsDOMUserMediaStream::CreateTrackUnionStream(window, hints);
|
||||
nsDOMUserMediaStream::CreateTrackUnionStream(window, mAudioSource,
|
||||
mVideoSource);
|
||||
if (!trackunion) {
|
||||
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> error = mError.forget();
|
||||
LOG(("Returning error for getUserMedia() - no stream"));
|
||||
error->OnError(NS_LITERAL_STRING("NO_STREAM"));
|
||||
return NS_OK;
|
||||
}
|
||||
trackunion->AudioConfig(aec_on, (uint32_t) aec,
|
||||
agc_on, (uint32_t) agc,
|
||||
noise_on, (uint32_t) noise,
|
||||
playout_delay);
|
||||
|
||||
|
||||
MediaStreamGraph* gm = MediaStreamGraph::GetInstance();
|
||||
nsRefPtr<SourceMediaStream> stream = gm->CreateSourceStream(nullptr);
|
||||
@ -572,33 +638,10 @@ public:
|
||||
new TracksAvailableCallback(mManager, mSuccess, mWindowID, trackunion);
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
// Right now these configs are only of use if webrtc is available
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);
|
||||
|
||||
if (branch) {
|
||||
int32_t aec = (int32_t) webrtc::kEcUnchanged;
|
||||
int32_t agc = (int32_t) webrtc::kAgcUnchanged;
|
||||
int32_t noise = (int32_t) webrtc::kNsUnchanged;
|
||||
bool aec_on = false, agc_on = false, noise_on = false;
|
||||
int32_t playout_delay = 0;
|
||||
|
||||
branch->GetBoolPref("media.peerconnection.aec_enabled", &aec_on);
|
||||
branch->GetIntPref("media.peerconnection.aec", &aec);
|
||||
branch->GetBoolPref("media.peerconnection.agc_enabled", &agc_on);
|
||||
branch->GetIntPref("media.peerconnection.agc", &agc);
|
||||
branch->GetBoolPref("media.peerconnection.noise_enabled", &noise_on);
|
||||
branch->GetIntPref("media.peerconnection.noise", &noise);
|
||||
branch->GetIntPref("media.peerconnection.playout_delay", &playout_delay);
|
||||
|
||||
mListener->AudioConfig(aec_on, (uint32_t) aec,
|
||||
agc_on, (uint32_t) agc,
|
||||
noise_on, (uint32_t) noise,
|
||||
playout_delay);
|
||||
}
|
||||
}
|
||||
mListener->AudioConfig(aec_on, (uint32_t) aec,
|
||||
agc_on, (uint32_t) agc,
|
||||
noise_on, (uint32_t) noise,
|
||||
playout_delay);
|
||||
#endif
|
||||
|
||||
// Dispatch to the media thread to ask it to start the sources,
|
||||
|
@ -264,27 +264,33 @@ pref("media.peerconnection.identity.timeout", 10000);
|
||||
// kXxxUnchanged = 0, kXxxDefault = 1, and higher values are specific to each
|
||||
// setting (for Xxx = Ec, Agc, or Ns). Defaults are all set to kXxxDefault here.
|
||||
pref("media.peerconnection.turn.disable", false);
|
||||
pref("media.peerconnection.aec_enabled", true);
|
||||
pref("media.peerconnection.aec", 1);
|
||||
pref("media.peerconnection.agc_enabled", false);
|
||||
pref("media.peerconnection.agc", 1);
|
||||
pref("media.peerconnection.noise_enabled", false);
|
||||
pref("media.peerconnection.noise", 1);
|
||||
// Adjustments for OS mediastream+output+OS+input delay (lower bound)
|
||||
pref("media.getusermedia.aec_enabled", true);
|
||||
pref("media.getusermedia.aec", 1);
|
||||
pref("media.getusermedia.agc_enabled", false);
|
||||
pref("media.getusermedia.agc", 1);
|
||||
pref("media.getusermedia.noise_enabled", true);
|
||||
pref("media.getusermedia.noise", 1);
|
||||
// Adjustments for OS-specific input delay (lower bound)
|
||||
// Adjustments for OS-specific AudioStream+cubeb+output delay (lower bound)
|
||||
#if defined(XP_MACOSX)
|
||||
pref("media.peerconnection.capture_delay", 50);
|
||||
pref("media.getusermedia.playout_delay", 10);
|
||||
#elif defined(XP_WIN)
|
||||
pref("media.peerconnection.capture_delay", 50);
|
||||
pref("media.getusermedia.playout_delay", 40);
|
||||
#elif defined(ANDROID)
|
||||
pref("media.peerconnection.capture_delay", 100);
|
||||
pref("media.getusermedia.playout_delay", 100);
|
||||
// Whether to enable Webrtc Hardware acceleration support
|
||||
pref("media.navigator.hardware.vp8_encode.acceleration_enabled", false);
|
||||
pref("media.navigator.hardware.vp8_decode.acceleration_enabled", false);
|
||||
#elif defined(XP_LINUX)
|
||||
pref("media.peerconnection.capture_delay", 70);
|
||||
pref("media.getusermedia.playout_delay", 50);
|
||||
#else
|
||||
// *BSD, others - merely a guess for now
|
||||
pref("media.peerconnection.capture_delay", 50);
|
||||
pref("media.getusermedia.playout_delay", 50);
|
||||
#endif
|
||||
#else
|
||||
#ifdef ANDROID
|
||||
|
Loading…
Reference in New Issue
Block a user