mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 1004396: Make video codec default bitrates configurable for WebRTC r=ekr
This commit is contained in:
parent
a82c2fce16
commit
5d71bfa862
@ -196,12 +196,42 @@ bool WebrtcVideoConduit::GetRTCPSenderReport(DOMHighResTimeStamp* timestamp,
|
||||
}
|
||||
|
||||
/**
|
||||
* Peforms intialization of the MANDATORY components of the Video Engine
|
||||
* Performs initialization of the MANDATORY components of the Video Engine
|
||||
*/
|
||||
MediaConduitErrorCode WebrtcVideoConduit::Init(WebrtcVideoConduit *other)
|
||||
{
|
||||
CSFLogDebug(logTag, "%s this=%p other=%p", __FUNCTION__, this, other);
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
// already know we must be on MainThread barring unit test weirdness
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
|
||||
if (!NS_WARN_IF(NS_FAILED(rv)))
|
||||
{
|
||||
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);
|
||||
|
||||
if (branch)
|
||||
{
|
||||
int32_t temp;
|
||||
NS_WARN_IF(NS_FAILED(branch->GetBoolPref("media.video.test_latency", &mVideoLatencyTestEnable)));
|
||||
NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.min_bitrate", &temp)));
|
||||
if (temp >= 0) {
|
||||
mMinBitrate = temp;
|
||||
}
|
||||
NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.start_bitrate", &temp)));
|
||||
if (temp >= 0) {
|
||||
mStartBitrate = temp;
|
||||
}
|
||||
NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.max_bitrate", &temp)));
|
||||
if (temp >= 0) {
|
||||
mMaxBitrate = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (other) {
|
||||
MOZ_ASSERT(!other->mOtherDirection);
|
||||
other->mOtherDirection = this;
|
||||
@ -734,20 +764,6 @@ WebrtcVideoConduit::ConfigureRecvMediaCodecs(
|
||||
return kMediaConduitUnknownError;
|
||||
}
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
if (NS_IsMainThread()) {
|
||||
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.video.test_latency", &mVideoLatencyTestEnable);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// by now we should be successfully started the reception
|
||||
mPtrRTP->SetRembStatus(mChannel, false, true);
|
||||
mEngineReceiving = true;
|
||||
@ -1099,11 +1115,11 @@ WebrtcVideoConduit::DeliverFrame(unsigned char* buffer,
|
||||
uint64_t now = PR_Now();
|
||||
uint64_t timestamp = 0;
|
||||
bool ok = YuvStamper::Decode(mReceivingWidth, mReceivingHeight, mReceivingWidth,
|
||||
buffer,
|
||||
reinterpret_cast<unsigned char*>(×tamp),
|
||||
sizeof(timestamp), 0, 0);
|
||||
buffer,
|
||||
reinterpret_cast<unsigned char*>(×tamp),
|
||||
sizeof(timestamp), 0, 0);
|
||||
if (ok) {
|
||||
VideoLatencyUpdate(now - timestamp);
|
||||
VideoLatencyUpdate(now - timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1131,9 +1147,9 @@ WebrtcVideoConduit::CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
|
||||
{
|
||||
cinst.maxFramerate = codecInfo->mMaxFrameRate;
|
||||
}
|
||||
cinst.minBitrate = 200;
|
||||
cinst.startBitrate = 300;
|
||||
cinst.maxBitrate = 2000;
|
||||
cinst.minBitrate = mMinBitrate;
|
||||
cinst.startBitrate = mStartBitrate;
|
||||
cinst.maxBitrate = mMaxBitrate;
|
||||
}
|
||||
|
||||
//Copy the codec passed into Conduit's database
|
||||
|
@ -228,11 +228,14 @@ public:
|
||||
mCapId(-1),
|
||||
mCurSendCodecConfig(nullptr),
|
||||
mSendingWidth(0),
|
||||
mSendingHeight(0),
|
||||
mReceivingWidth(640),
|
||||
mReceivingHeight(480),
|
||||
mVideoLatencyTestEnable(false),
|
||||
mVideoLatencyAvg(0)
|
||||
mSendingHeight(0),
|
||||
mReceivingWidth(640),
|
||||
mReceivingHeight(480),
|
||||
mVideoLatencyTestEnable(false),
|
||||
mVideoLatencyAvg(0),
|
||||
mMinBitrate(200),
|
||||
mStartBitrate(300),
|
||||
mMaxBitrate(2000)
|
||||
{
|
||||
}
|
||||
|
||||
@ -326,6 +329,9 @@ private:
|
||||
unsigned short mReceivingHeight;
|
||||
bool mVideoLatencyTestEnable;
|
||||
uint64_t mVideoLatencyAvg;
|
||||
uint32_t mMinBitrate;
|
||||
uint32_t mStartBitrate;
|
||||
uint32_t mMaxBitrate;
|
||||
|
||||
static const unsigned int sAlphaNum = 7;
|
||||
static const unsigned int sAlphaDen = 8;
|
||||
|
@ -266,6 +266,9 @@ pref("media.peerconnection.video.enabled", true);
|
||||
pref("media.navigator.video.max_fs", 0); // unrestricted
|
||||
pref("media.navigator.video.max_fr", 0); // unrestricted
|
||||
#endif
|
||||
pref("media.peerconnection.video.min_bitrate", 200);
|
||||
pref("media.peerconnection.video.start_bitrate", 300);
|
||||
pref("media.peerconnection.video.max_bitrate", 2000);
|
||||
pref("media.navigator.permission.disabled", false);
|
||||
pref("media.peerconnection.default_iceservers", "[{\"url\": \"stun:stun.services.mozilla.com\"}]");
|
||||
pref("media.peerconnection.trickle_ice", true);
|
||||
|
Loading…
Reference in New Issue
Block a user