Remove static initializer from WebRtcVideoEngine2.
BUG= R=pliard@google.com, pthatcher@webrtc.org, pliard@chromium.org Review URL: https://webrtc-codereview.appspot.com/15679005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6338 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
aafd7a88c5
commit
0d523eea83
@ -192,6 +192,9 @@ static std::vector<VideoCodec> DefaultVideoCodecs() {
|
|||||||
return codecs;
|
return codecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebRtcVideoEncoderFactory2::~WebRtcVideoEncoderFactory2() {
|
||||||
|
}
|
||||||
|
|
||||||
class DefaultVideoEncoderFactory : public WebRtcVideoEncoderFactory2 {
|
class DefaultVideoEncoderFactory : public WebRtcVideoEncoderFactory2 {
|
||||||
public:
|
public:
|
||||||
virtual bool CreateEncoderSettings(
|
virtual bool CreateEncoderSettings(
|
||||||
@ -239,7 +242,7 @@ class DefaultVideoEncoderFactory : public WebRtcVideoEncoderFactory2 {
|
|||||||
virtual bool SupportsCodec(const VideoCodec& codec) OVERRIDE {
|
virtual bool SupportsCodec(const VideoCodec& codec) OVERRIDE {
|
||||||
return _stricmp(codec.name.c_str(), kVp8PayloadName) == 0;
|
return _stricmp(codec.name.c_str(), kVp8PayloadName) == 0;
|
||||||
}
|
}
|
||||||
} default_encoder_factory;
|
};
|
||||||
|
|
||||||
WebRtcVideoEngine2::WebRtcVideoEngine2() {
|
WebRtcVideoEngine2::WebRtcVideoEngine2() {
|
||||||
// Construct without a factory or voice engine.
|
// Construct without a factory or voice engine.
|
||||||
@ -265,6 +268,7 @@ void WebRtcVideoEngine2::Construct(WebRtcVideoChannelFactory* channel_factory,
|
|||||||
|
|
||||||
video_codecs_ = DefaultVideoCodecs();
|
video_codecs_ = DefaultVideoCodecs();
|
||||||
default_codec_format_ = VideoFormat(kDefaultVideoFormat);
|
default_codec_format_ = VideoFormat(kDefaultVideoFormat);
|
||||||
|
default_video_encoder_factory_.reset(new DefaultVideoEncoderFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcVideoEngine2::~WebRtcVideoEngine2() {
|
WebRtcVideoEngine2::~WebRtcVideoEngine2() {
|
||||||
@ -328,7 +332,7 @@ WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel(
|
|||||||
channel_factory_ != NULL
|
channel_factory_ != NULL
|
||||||
? channel_factory_->Create(this, voice_channel)
|
? channel_factory_->Create(this, voice_channel)
|
||||||
: new WebRtcVideoChannel2(
|
: new WebRtcVideoChannel2(
|
||||||
this, voice_channel, GetDefaultVideoEncoderFactory());
|
this, voice_channel, GetVideoEncoderFactory());
|
||||||
if (!channel->Init()) {
|
if (!channel->Init()) {
|
||||||
delete channel;
|
delete channel;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -463,9 +467,8 @@ bool WebRtcVideoEngine2::ShouldIgnoreTrace(const std::string& trace) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcVideoEncoderFactory2* WebRtcVideoEngine2::GetDefaultVideoEncoderFactory()
|
WebRtcVideoEncoderFactory2* WebRtcVideoEngine2::GetVideoEncoderFactory() const {
|
||||||
const {
|
return default_video_encoder_factory_.get();
|
||||||
return &default_encoder_factory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thin map between cricket::VideoFrame and an existing webrtc::I420VideoFrame
|
// Thin map between cricket::VideoFrame and an existing webrtc::I420VideoFrame
|
||||||
|
@ -82,6 +82,7 @@ class WebRtcVideoChannel2;
|
|||||||
|
|
||||||
class WebRtcVideoEncoderFactory2 {
|
class WebRtcVideoEncoderFactory2 {
|
||||||
public:
|
public:
|
||||||
|
virtual ~WebRtcVideoEncoderFactory2();
|
||||||
virtual bool CreateEncoderSettings(
|
virtual bool CreateEncoderSettings(
|
||||||
webrtc::VideoSendStream::Config::EncoderSettings* encoder_settings,
|
webrtc::VideoSendStream::Config::EncoderSettings* encoder_settings,
|
||||||
const VideoOptions& options,
|
const VideoOptions& options,
|
||||||
@ -139,7 +140,7 @@ class WebRtcVideoEngine2 : public sigslot::has_slots<> {
|
|||||||
|
|
||||||
talk_base::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
|
talk_base::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
|
||||||
|
|
||||||
virtual WebRtcVideoEncoderFactory2* GetDefaultVideoEncoderFactory() const;
|
virtual WebRtcVideoEncoderFactory2* GetVideoEncoderFactory() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Construct(WebRtcVideoChannelFactory* channel_factory,
|
void Construct(WebRtcVideoChannelFactory* channel_factory,
|
||||||
@ -162,6 +163,8 @@ class WebRtcVideoEngine2 : public sigslot::has_slots<> {
|
|||||||
|
|
||||||
talk_base::scoped_ptr<talk_base::CpuMonitor> cpu_monitor_;
|
talk_base::scoped_ptr<talk_base::CpuMonitor> cpu_monitor_;
|
||||||
WebRtcVideoChannelFactory* channel_factory_;
|
WebRtcVideoChannelFactory* channel_factory_;
|
||||||
|
talk_base::scoped_ptr<WebRtcVideoEncoderFactory2>
|
||||||
|
default_video_encoder_factory_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Adapter between webrtc::VideoRenderer and cricket::VideoRenderer.
|
// Adapter between webrtc::VideoRenderer and cricket::VideoRenderer.
|
||||||
|
@ -243,9 +243,7 @@ class FakeWebRtcVideoChannel2 : public WebRtcVideoChannel2 {
|
|||||||
FakeWebRtcVideoChannel2(FakeCall* call,
|
FakeWebRtcVideoChannel2(FakeCall* call,
|
||||||
WebRtcVideoEngine2* engine,
|
WebRtcVideoEngine2* engine,
|
||||||
VoiceMediaChannel* voice_channel)
|
VoiceMediaChannel* voice_channel)
|
||||||
: WebRtcVideoChannel2(call,
|
: WebRtcVideoChannel2(call, engine, engine->GetVideoEncoderFactory()),
|
||||||
engine,
|
|
||||||
engine->GetDefaultVideoEncoderFactory()),
|
|
||||||
fake_call_(call),
|
fake_call_(call),
|
||||||
voice_channel_(voice_channel) {}
|
voice_channel_(voice_channel) {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user