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
This commit is contained in:
parent
27d106bcf7
commit
40b276ea7b
@ -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;
|
||||
|
@ -167,7 +167,7 @@ template <class Base> class RtpHelper : public Base {
|
||||
}
|
||||
// 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();
|
||||
|
@ -84,7 +84,7 @@ class Settable {
|
||||
return set_ ? val_ : default_value;
|
||||
}
|
||||
|
||||
virtual void Set(T val) {
|
||||
void Set(T val) {
|
||||
set_ = true;
|
||||
val_ = val;
|
||||
}
|
||||
@ -126,19 +126,6 @@ class Settable {
|
||||
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 @@ struct VideoOptions {
|
||||
// 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.
|
||||
|
@ -129,11 +129,15 @@ enum FourCC {
|
||||
|
||||
// 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);
|
||||
|
||||
|
@ -87,6 +87,22 @@ cricket::VideoFormat VideoFormatFromVieCodec(const webrtc::VideoCodec& codec) {
|
||||
return CreateVideoFormat(codec.width, codec.height, codec.maxFramerate);
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -3080,6 +3096,9 @@ bool WebRtcVideoMediaChannel::SetOptions(const VideoOptions &options) {
|
||||
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) {
|
||||
|
@ -482,7 +482,8 @@ cricket::VideoFormat ScreencastFormatFromFps(int fps) {
|
||||
// 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,
|
||||
|
@ -76,7 +76,6 @@ class AudioSourceProxy: public AudioSourceContext, public sigslot::has_slots<> {
|
||||
void OnMediaStreamsUpdate(Call* call, cricket::Session*,
|
||||
const cricket::MediaStreams&, const cricket::MediaStreams&);
|
||||
|
||||
AudioSourceContext* audio_source_context_;
|
||||
Call* call_;
|
||||
};
|
||||
|
||||
|
@ -430,6 +430,7 @@ namespace sigslot {
|
||||
class _signal_base_interface
|
||||
{
|
||||
public:
|
||||
virtual ~_signal_base_interface() {}
|
||||
virtual void slot_disconnect(has_slots_interface* pslot) = 0;
|
||||
virtual void slot_duplicate(const has_slots_interface* poldslot, has_slots_interface* pnewslot) = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user