Cleanup little things found when refactoring.
R=juberti@google.com
Review URL: https://webrtc-codereview.appspot.com/33519004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7880 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc
index f651af5..683efac 100644
--- a/talk/app/webrtc/webrtcsession.cc
+++ b/talk/app/webrtc/webrtcsession.cc
@@ -48,6 +48,7 @@
#include "webrtc/base/logging.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
+#include "webrtc/p2p/base/portallocator.h"
using cricket::ContentInfo;
using cricket::ContentInfos;
diff --git a/talk/media/base/fakemediaengine.h b/talk/media/base/fakemediaengine.h
index ff6ae16..c5de323 100644
--- a/talk/media/base/fakemediaengine.h
+++ b/talk/media/base/fakemediaengine.h
@@ -167,7 +167,7 @@
}
// TODO(perkj): This is to support legacy unit test that only check one
// sending stream.
- const uint32 send_ssrc() {
+ uint32 send_ssrc() const {
if (send_streams_.empty())
return 0;
return send_streams_[0].first_ssrc();
diff --git a/talk/media/base/mediachannel.h b/talk/media/base/mediachannel.h
index 5e03ef9..cb50490 100644
--- a/talk/media/base/mediachannel.h
+++ b/talk/media/base/mediachannel.h
@@ -84,7 +84,7 @@
return set_ ? val_ : default_value;
}
- virtual void Set(T val) {
+ void Set(T val) {
set_ = true;
val_ = val;
}
@@ -126,19 +126,6 @@
T val_;
};
-class SettablePercent : public Settable<float> {
- public:
- virtual void Set(float val) {
- if (val < 0) {
- val = 0;
- }
- if (val > 1.0) {
- val = 1.0;
- }
- Settable<float>::Set(val);
- }
-};
-
template <class T>
static std::string ToStringIfSet(const char* key, const Settable<T>& val) {
std::string str;
@@ -431,11 +418,11 @@
// Use conference mode?
Settable<bool> conference_mode;
// Threshhold for process cpu adaptation. (Process limit)
- SettablePercent process_adaptation_threshhold;
+ Settable<float> process_adaptation_threshhold;
// Low threshhold for cpu adaptation. (Adapt up)
- SettablePercent system_low_adaptation_threshhold;
+ Settable<float> system_low_adaptation_threshhold;
// High threshhold for cpu adaptation. (Adapt down)
- SettablePercent system_high_adaptation_threshhold;
+ Settable<float> system_high_adaptation_threshhold;
// Specify buffered mode latency in milliseconds.
Settable<int> buffered_mode_latency;
// Set DSCP value for packet sent from video channel.
diff --git a/talk/media/base/videocommon.h b/talk/media/base/videocommon.h
index a175c13..fc05580 100644
--- a/talk/media/base/videocommon.h
+++ b/talk/media/base/videocommon.h
@@ -129,11 +129,15 @@
// 1 Auxiliary compressed YUV format set aside for capturer.
FOURCC_H264 = FOURCC('H', '2', '6', '4'),
-
- // Match any fourcc.
- FOURCC_ANY = 0xFFFFFFFF,
};
+// Match any fourcc.
+
+// We move this out of the enum because using it in many places caused
+// the compiler to get grumpy, presumably since the above enum is
+// backed by an int.
+static const uint32 FOURCC_ANY = 0xFFFFFFFF;
+
// Converts fourcc aliases into canonical ones.
uint32 CanonicalFourCC(uint32 fourcc);
diff --git a/talk/media/webrtc/webrtcvideoengine.cc b/talk/media/webrtc/webrtcvideoengine.cc
index 139d508..1785cc2 100644
--- a/talk/media/webrtc/webrtcvideoengine.cc
+++ b/talk/media/webrtc/webrtcvideoengine.cc
@@ -88,6 +88,22 @@
}
template <class T>
+void Clamp(cricket::Settable<T>* box, T min, T max) {
+ T val;
+ if (!box->Get(&val)) {
+ return;
+ }
+ if (val < min) {
+ box->Set(min);
+ return;
+ }
+ if (val > max) {
+ box->Set(max);
+ return;
+ }
+}
+
+template <class T>
bool Changed(cricket::Settable<T> proposed,
cricket::Settable<T> original) {
return proposed.IsSet() && proposed != original;
@@ -3080,6 +3096,9 @@
VideoOptions original = options_;
options_.SetAll(options);
+ Clamp(&options_.system_low_adaptation_threshhold, 0.0f, 1.0f);
+ Clamp(&options_.system_high_adaptation_threshhold, 0.0f, 1.0f);
+
bool use_simulcast_adapter;
if (options.use_simulcast_adapter.Get(&use_simulcast_adapter) &&
options.use_simulcast_adapter != original.use_simulcast_adapter) {
diff --git a/talk/session/media/call.cc b/talk/session/media/call.cc
index 7e59ac6..784be94 100644
--- a/talk/session/media/call.cc
+++ b/talk/session/media/call.cc
@@ -482,7 +482,8 @@
// case, it can't be 0x0, or the CaptureManager will fail to use it.
return cricket::VideoFormat(
1, 1,
- cricket::VideoFormat::FpsToInterval(fps), cricket::FOURCC_ANY);
+ cricket::VideoFormat::FpsToInterval(fps),
+ cricket::FOURCC_ANY);
}
bool Call::StartScreencast(Session* session,
diff --git a/talk/session/media/call.h b/talk/session/media/call.h
index 5a2d49b..f992043 100644
--- a/talk/session/media/call.h
+++ b/talk/session/media/call.h
@@ -76,7 +76,6 @@
void OnMediaStreamsUpdate(Call* call, cricket::Session*,
const cricket::MediaStreams&, const cricket::MediaStreams&);
- AudioSourceContext* audio_source_context_;
Call* call_;
};