Bug 1570212 - Convert media.webrtc.net.force_disable_rtcp_reception to a static pref. r=jya

Differential Revision: https://phabricator.services.mozilla.com/D40154

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-08-02 12:33:17 +00:00
parent 0fea42328a
commit 2bdd4bbfd0
3 changed files with 8 additions and 21 deletions

View File

@ -34,6 +34,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/SharedThreadPool.h"
#include "mozilla/Sprintf.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/TaskQueue.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/UniquePtrExtensions.h"
@ -64,14 +65,6 @@ mozilla::LazyLogModule gMediaPipelineLog("MediaPipeline");
namespace mozilla {
// When enabled, this pref disables the reception of RTCP. This is used
// for testing.
static const auto kQuashRtcpRxPref =
NS_LITERAL_CSTRING("media.webrtc.net.force_disable_rtcp_reception");
Atomic<bool, ReleaseAcquire> MediaPipeline::sPrefsRegistered(false);
Atomic<bool, ReleaseAcquire> MediaPipeline::sForceDisableRtcpReceptionPref(
false);
// An async inserter for audio data, to avoid running audio codec encoders
// on the MSG/input audio thread. Basically just bounces all the audio
// data to a single audio processing/input queue. We could if we wanted to
@ -271,13 +264,6 @@ MediaPipeline::MediaPipeline(const std::string& aPc,
} else {
mConduit->SetTransmitterTransport(mTransport);
}
if (!sPrefsRegistered.exchange(true)) {
MOZ_ASSERT(Preferences::IsServiceAvailable());
Preferences::AddAtomicBoolVarCache(&sForceDisableRtcpReceptionPref,
kQuashRtcpRxPref, false);
MOZ_LOG(gMediaPipelineLog, LogLevel::Info,
("Creating pref cache: %s succeeded", kQuashRtcpRxPref.get()));
}
}
MediaPipeline::~MediaPipeline() {
@ -619,7 +605,7 @@ void MediaPipeline::RtcpPacketReceived(MediaPacket& packet) {
mPacketDumper->Dump(mLevel, dom::mozPacketDumpType::Rtcp, false,
packet.data(), packet.len());
if (sForceDisableRtcpReceptionPref) {
if (StaticPrefs::media_webrtc_net_force_disable_rtcp_reception()) {
MOZ_LOG(gMediaPipelineLog, LogLevel::Debug,
("%s RTCP packet forced to be dropped", mDescription.c_str()));
return;

View File

@ -260,11 +260,6 @@ class MediaPipeline : public sigslot::has_slots<> {
bool IsRtp(const unsigned char* aData, size_t aLen) const;
// Must be called on the STS thread. Must be called after DetachMedia().
void DetachTransport_s();
// Cached preferences are not tolerant of being registered more than once
static Atomic<bool, ReleaseAcquire> sPrefsRegistered;
// Cached pref media.webrtc.net.force_disable_rtcp_reception
static Atomic<bool, ReleaseAcquire> sForceDisableRtcpReceptionPref;
};
// A specialization of pipeline for reading from an input device

View File

@ -4918,6 +4918,12 @@
value: false
mirror: always
# This pref disables the reception of RTCP. It is used for testing.
- name: media.webrtc.net.force_disable_rtcp_reception
type: ReleaseAcquireAtomicBool
value: false
mirror: always
# TextTrack WebVTT Region extension support.
- name: media.webvtt.regions.enabled
type: bool