diff options
-rw-r--r-- | media/base/fakemediaengine.h | 4 | ||||
-rw-r--r-- | media/base/filemediaengine.h | 3 | ||||
-rw-r--r-- | media/base/mediaengine.h | 6 | ||||
-rw-r--r-- | media/webrtc/webrtcmediaengine.h | 3 | ||||
-rw-r--r-- | media/webrtc/webrtcvideoengine.h | 2 | ||||
-rw-r--r-- | media/webrtc/webrtcvideoengine2.cc | 9 | ||||
-rw-r--r-- | media/webrtc/webrtcvideoengine2.h | 3 | ||||
-rw-r--r-- | session/media/channelmanager.cc | 33 | ||||
-rw-r--r-- | session/media/channelmanager.h | 7 |
9 files changed, 47 insertions, 23 deletions
diff --git a/media/base/fakemediaengine.h b/media/base/fakemediaengine.h index 8963aa7..a6eabef 100644 --- a/media/base/fakemediaengine.h +++ b/media/base/fakemediaengine.h @@ -930,6 +930,10 @@ class FakeVideoEngine : public FakeBaseEngine { capture_ = capture; return true; } + VideoFormat GetStartCaptureFormat() const { + return VideoFormat(640, 480, cricket::VideoFormat::FpsToInterval(30), + FOURCC_I420); + } sigslot::repeater2<VideoCapturer*, CaptureState> SignalCaptureStateChange; diff --git a/media/base/filemediaengine.h b/media/base/filemediaengine.h index ad6c938..981e945 100644 --- a/media/base/filemediaengine.h +++ b/media/base/filemediaengine.h @@ -150,6 +150,9 @@ class FileMediaEngine : public MediaEngineInterface { MediaProcessorDirection direction) { return true; } + VideoFormat GetStartCaptureFormat() const { + return VideoFormat(); + } virtual sigslot::repeater2<VideoCapturer*, CaptureState>& SignalVideoCaptureStateChange() { diff --git a/media/base/mediaengine.h b/media/base/mediaengine.h index 9daa05d..25f7eb3 100644 --- a/media/base/mediaengine.h +++ b/media/base/mediaengine.h @@ -147,6 +147,8 @@ class MediaEngineInterface { VoiceProcessor* video_processor, MediaProcessorDirection direction) = 0; + virtual VideoFormat GetStartCaptureFormat() const = 0; + virtual sigslot::repeater2<VideoCapturer*, CaptureState>& SignalVideoCaptureStateChange() = 0; }; @@ -276,6 +278,9 @@ class CompositeMediaEngine : public MediaEngineInterface { MediaProcessorDirection direction) { return voice_.UnregisterProcessor(ssrc, processor, direction); } + virtual VideoFormat GetStartCaptureFormat() const { + return video_.GetStartCaptureFormat(); + } virtual sigslot::repeater2<VideoCapturer*, CaptureState>& SignalVideoCaptureStateChange() { return signal_state_change_; @@ -356,6 +361,7 @@ class NullVideoEngine { return rtp_header_extensions_; } void SetLogging(int min_sev, const char* filter) {} + VideoFormat GetStartCaptureFormat() const { return VideoFormat(); } sigslot::signal2<VideoCapturer*, CaptureState> SignalCaptureStateChange; private: diff --git a/media/webrtc/webrtcmediaengine.h b/media/webrtc/webrtcmediaengine.h index 1700878..2a8c66c 100644 --- a/media/webrtc/webrtcmediaengine.h +++ b/media/webrtc/webrtcmediaengine.h @@ -185,6 +185,9 @@ class DelegatingWebRtcMediaEngine : public cricket::MediaEngineInterface { return delegate_->UnregisterVoiceProcessor(ssrc, video_processor, direction); } + virtual VideoFormat GetStartCaptureFormat() const OVERRIDE { + return delegate_->GetStartCaptureFormat(); + } virtual sigslot::repeater2<VideoCapturer*, CaptureState>& SignalVideoCaptureStateChange() { return delegate_->SignalVideoCaptureStateChange(); diff --git a/media/webrtc/webrtcvideoengine.h b/media/webrtc/webrtcvideoengine.h index b6c37af..4e41809 100644 --- a/media/webrtc/webrtcvideoengine.h +++ b/media/webrtc/webrtcvideoengine.h @@ -169,6 +169,8 @@ class WebRtcVideoEngine : public sigslot::has_slots<>, bool ShouldIgnoreTrace(const std::string& trace); int GetNumOfChannels(); + VideoFormat GetStartCaptureFormat() const { return default_codec_format_; } + rtc::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); } protected: diff --git a/media/webrtc/webrtcvideoengine2.cc b/media/webrtc/webrtcvideoengine2.cc index d63e8f4..44c1bf8 100644 --- a/media/webrtc/webrtcvideoengine2.cc +++ b/media/webrtc/webrtcvideoengine2.cc @@ -286,6 +286,10 @@ WebRtcVideoEngine2::WebRtcVideoEngine2() : worker_thread_(NULL), voice_engine_(NULL), video_codecs_(DefaultVideoCodecs()), + default_codec_format_(kDefaultVideoCodecPref.width, + kDefaultVideoCodecPref.height, + FPS_TO_INTERVAL(kDefaultFramerate), + FOURCC_ANY), initialized_(false), cpu_monitor_(new rtc::CpuMonitor(NULL)), channel_factory_(NULL) { @@ -354,6 +358,11 @@ bool WebRtcVideoEngine2::SetDefaultEncoderConfig( return false; } + default_codec_format_ = + VideoFormat(codec.width, + codec.height, + VideoFormat::FpsToInterval(codec.framerate), + FOURCC_ANY); video_codecs_.clear(); video_codecs_.push_back(codec); return true; diff --git a/media/webrtc/webrtcvideoengine2.h b/media/webrtc/webrtcvideoengine2.h index ab644d0..d77afb9 100644 --- a/media/webrtc/webrtcvideoengine2.h +++ b/media/webrtc/webrtcvideoengine2.h @@ -168,6 +168,8 @@ class WebRtcVideoEngine2 : public sigslot::has_slots<> { // Check whether the supplied trace should be ignored. bool ShouldIgnoreTrace(const std::string& trace); + VideoFormat GetStartCaptureFormat() const { return default_codec_format_; } + rtc::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); } virtual WebRtcVideoEncoderFactory2* GetVideoEncoderFactory(); @@ -177,6 +179,7 @@ class WebRtcVideoEngine2 : public sigslot::has_slots<> { WebRtcVoiceEngine* voice_engine_; std::vector<VideoCodec> video_codecs_; std::vector<RtpHeaderExtension> rtp_header_extensions_; + VideoFormat default_codec_format_; bool initialized_; diff --git a/session/media/channelmanager.cc b/session/media/channelmanager.cc index 2803a7e..45e7e47 100644 --- a/session/media/channelmanager.cc +++ b/session/media/channelmanager.cc @@ -724,28 +724,16 @@ bool ChannelManager::SetCaptureDevice_w(const Device* cam_device) { } bool ChannelManager::SetDefaultVideoEncoderConfig(const VideoEncoderConfig& c) { - return worker_thread_->Invoke<bool>( - Bind(&ChannelManager::SetDefaultVideoEncoderConfig_w, this, c)); -} - -VideoEncoderConfig ChannelManager::GetDefaultVideoEncoderConfig() const { - return worker_thread_->Invoke<VideoEncoderConfig>( - Bind(&ChannelManager::GetDefaultVideoEncoderConfig_w, this)); -} - -bool ChannelManager::SetDefaultVideoEncoderConfig_w( - const VideoEncoderConfig& c) { + bool ret = true; if (initialized_) { - if (!media_engine_->SetDefaultVideoEncoderConfig(c)) { - return false; - } + ret = worker_thread_->Invoke<bool>( + Bind(&MediaEngineInterface::SetDefaultVideoEncoderConfig, + media_engine_.get(), c)); } - default_video_encoder_config_ = c; - return true; -} - -VideoEncoderConfig ChannelManager::GetDefaultVideoEncoderConfig_w() const { - return default_video_encoder_config_; + if (ret) { + default_video_encoder_config_ = c; + } + return ret; } bool ChannelManager::SetLocalMonitor(bool enable) { @@ -957,6 +945,11 @@ void ChannelManager::SetVideoCaptureDeviceMaxFormat( device_manager_->SetVideoCaptureDeviceMaxFormat(usb_id, max_format); } +VideoFormat ChannelManager::GetStartCaptureFormat() { + return worker_thread_->Invoke<VideoFormat>( + Bind(&MediaEngineInterface::GetStartCaptureFormat, media_engine_.get())); +} + bool ChannelManager::StartAecDump(rtc::PlatformFile file) { return worker_thread_->Invoke<bool>( Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file)); diff --git a/session/media/channelmanager.h b/session/media/channelmanager.h index 47cb6e5..fa79014 100644 --- a/session/media/channelmanager.h +++ b/session/media/channelmanager.h @@ -163,7 +163,6 @@ class ChannelManager : public rtc::MessageHandler, VideoCapturer* CreateScreenCapturer(const ScreencastId& screenid); bool SetCaptureDevice(const std::string& cam_device); bool SetDefaultVideoEncoderConfig(const VideoEncoderConfig& config); - VideoEncoderConfig GetDefaultVideoEncoderConfig() const; // RTX will be enabled/disabled in engines that support it. The supporting // engines will start offering an RTX codec. Must be called before Init(). bool SetVideoRtxEnabled(bool enable); @@ -231,6 +230,10 @@ class ChannelManager : public rtc::MessageHandler, // This API is mainly a hook used by unittests. const std::string& video_device_name() const { return video_device_name_; } + // TODO(hellner): Remove this function once the engine capturer has been + // removed. + VideoFormat GetStartCaptureFormat(); + protected: // Adds non-transient parameters which can only be changed through the // options store. @@ -279,8 +282,6 @@ class ChannelManager : public rtc::MessageHandler, bool UnregisterVideoProcessor_w(VideoCapturer* capturer, VideoProcessor* processor); bool IsScreencastRunning_w() const; - bool SetDefaultVideoEncoderConfig_w(const VideoEncoderConfig& config); - VideoEncoderConfig GetDefaultVideoEncoderConfig_w() const; virtual void OnMessage(rtc::Message *message); rtc::scoped_ptr<MediaEngineInterface> media_engine_; |