diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc index ec0456f7cb..c14f720502 100644 --- a/talk/app/webrtc/webrtcsession.cc +++ b/talk/app/webrtc/webrtcsession.cc @@ -706,16 +706,6 @@ bool WebRtcSession::Initialize( audio_options_.audio_jitter_buffer_fast_accelerate = rtc::Optional( rtc_configuration.audio_jitter_buffer_fast_accelerate); - const cricket::VideoCodec default_codec( - JsepSessionDescription::kDefaultVideoCodecId, - JsepSessionDescription::kDefaultVideoCodecName, - JsepSessionDescription::kMaxVideoCodecWidth, - JsepSessionDescription::kMaxVideoCodecHeight, - JsepSessionDescription::kDefaultVideoCodecFramerate, - JsepSessionDescription::kDefaultVideoCodecPreference); - channel_manager_->SetDefaultVideoEncoderConfig( - cricket::VideoEncoderConfig(default_codec)); - if (!dtls_enabled_) { // Construct with DTLS disabled. webrtc_session_desc_factory_.reset(new WebRtcSessionDescriptionFactory( diff --git a/talk/media/base/codec.h b/talk/media/base/codec.h index afdf5fdad9..ea6c5415dc 100644 --- a/talk/media/base/codec.h +++ b/talk/media/base/codec.h @@ -209,50 +209,6 @@ struct DataCodec : public Codec { std::string ToString() const; }; -struct VideoEncoderConfig { - static const int kDefaultMaxThreads = -1; - static const int kDefaultCpuProfile = -1; - - VideoEncoderConfig() - : max_codec(), - num_threads(kDefaultMaxThreads), - cpu_profile(kDefaultCpuProfile) { - } - - VideoEncoderConfig(const VideoCodec& c) - : max_codec(c), - num_threads(kDefaultMaxThreads), - cpu_profile(kDefaultCpuProfile) { - } - - VideoEncoderConfig(const VideoCodec& c, int t, int p) - : max_codec(c), - num_threads(t), - cpu_profile(p) { - } - - VideoEncoderConfig& operator=(const VideoEncoderConfig& config) { - max_codec = config.max_codec; - num_threads = config.num_threads; - cpu_profile = config.cpu_profile; - return *this; - } - - bool operator==(const VideoEncoderConfig& config) const { - return max_codec == config.max_codec && - num_threads == config.num_threads && - cpu_profile == config.cpu_profile; - } - - bool operator!=(const VideoEncoderConfig& config) const { - return !(*this == config); - } - - VideoCodec max_codec; - int num_threads; - int cpu_profile; -}; - // Get the codec setting associated with |payload_type|. If there // is no codec associated with that payload type it returns false. template diff --git a/talk/media/base/codec_unittest.cc b/talk/media/base/codec_unittest.cc index 7bd3735a9b..b2aff507ea 100644 --- a/talk/media/base/codec_unittest.cc +++ b/talk/media/base/codec_unittest.cc @@ -33,7 +33,6 @@ using cricket::Codec; using cricket::DataCodec; using cricket::FeedbackParam; using cricket::VideoCodec; -using cricket::VideoEncoderConfig; using cricket::kCodecParamAssociatedPayloadType; using cricket::kCodecParamMaxBitrate; using cricket::kCodecParamMinBitrate; @@ -214,54 +213,6 @@ TEST_F(CodecTest, TestVideoCodecMatches) { EXPECT_FALSE(c1.Matches(VideoCodec(95, "V", 640, 400, 15, 0))); } -TEST_F(CodecTest, TestVideoEncoderConfigOperators) { - VideoEncoderConfig c1(VideoCodec( - 96, "SVC", 320, 200, 30, 3), 1, 2); - VideoEncoderConfig c2(VideoCodec( - 95, "SVC", 320, 200, 30, 3), 1, 2); - VideoEncoderConfig c3(VideoCodec( - 96, "xxx", 320, 200, 30, 3), 1, 2); - VideoEncoderConfig c4(VideoCodec( - 96, "SVC", 120, 200, 30, 3), 1, 2); - VideoEncoderConfig c5(VideoCodec( - 96, "SVC", 320, 100, 30, 3), 1, 2); - VideoEncoderConfig c6(VideoCodec( - 96, "SVC", 320, 200, 10, 3), 1, 2); - VideoEncoderConfig c7(VideoCodec( - 96, "SVC", 320, 200, 30, 1), 1, 2); - VideoEncoderConfig c8(VideoCodec( - 96, "SVC", 320, 200, 30, 3), 0, 2); - VideoEncoderConfig c9(VideoCodec( - 96, "SVC", 320, 200, 30, 3), 1, 1); - EXPECT_TRUE(c1 != c2); - EXPECT_TRUE(c1 != c2); - EXPECT_TRUE(c1 != c3); - EXPECT_TRUE(c1 != c4); - EXPECT_TRUE(c1 != c5); - EXPECT_TRUE(c1 != c6); - EXPECT_TRUE(c1 != c7); - EXPECT_TRUE(c1 != c8); - EXPECT_TRUE(c1 != c9); - - VideoEncoderConfig c10; - VideoEncoderConfig c11(VideoCodec( - 0, "", 0, 0, 0, 0)); - VideoEncoderConfig c12(VideoCodec( - 0, "", 0, 0, 0, 0), - VideoEncoderConfig::kDefaultMaxThreads, - VideoEncoderConfig::kDefaultCpuProfile); - VideoEncoderConfig c13 = c1; - VideoEncoderConfig c14(VideoCodec( - 0, "", 0, 0, 0, 0), 0, 0); - - EXPECT_TRUE(c11 == c10); - EXPECT_TRUE(c12 == c10); - EXPECT_TRUE(c13 != c10); - EXPECT_TRUE(c13 == c1); - EXPECT_TRUE(c14 != c11); - EXPECT_TRUE(c14 != c12); -} - TEST_F(CodecTest, TestDataCodecMatches) { // Test a codec with a static payload type. DataCodec c0(95, "D", 0); diff --git a/talk/media/base/fakemediaengine.h b/talk/media/base/fakemediaengine.h index b1f09aaf64..9dbb649e3d 100644 --- a/talk/media/base/fakemediaengine.h +++ b/talk/media/base/fakemediaengine.h @@ -783,13 +783,6 @@ class FakeVideoEngine : public FakeBaseEngine { options_changed_ = true; return true; } - bool SetDefaultEncoderConfig(const VideoEncoderConfig& config) { - default_encoder_config_ = config; - return true; - } - const VideoEncoderConfig& default_encoder_config() const { - return default_encoder_config_; - } VideoMediaChannel* CreateChannel(webrtc::Call* call, const VideoOptions& options) { @@ -832,7 +825,6 @@ class FakeVideoEngine : public FakeBaseEngine { private: std::vector channels_; std::vector codecs_; - VideoEncoderConfig default_encoder_config_; std::string in_device_; bool capture_; VideoOptions options_; @@ -870,9 +862,6 @@ class FakeMediaEngine : } int output_volume() const { return voice_.output_volume_; } - const VideoEncoderConfig& default_video_encoder_config() const { - return video_.default_encoder_config_; - } bool capture() const { return video_.capture_; } bool options_changed() const { return video_.options_changed_; diff --git a/talk/media/base/mediaengine.h b/talk/media/base/mediaengine.h index cc033a71dc..43b4de5a52 100644 --- a/talk/media/base/mediaengine.h +++ b/talk/media/base/mediaengine.h @@ -88,11 +88,6 @@ class MediaEngineInterface { webrtc::Call* call, const VideoOptions& options) = 0; - // Sets the default (maximum) codec/resolution and encoder option to capture - // and encode video. - virtual bool SetDefaultVideoEncoderConfig(const VideoEncoderConfig& config) - = 0; - // Device configuration // Gets the current speaker volume, as a value between 0 and 255. virtual bool GetOutputVolume(int* level) = 0; @@ -167,10 +162,6 @@ class CompositeMediaEngine : public MediaEngineInterface { return video_.CreateChannel(call, options); } - virtual bool SetDefaultVideoEncoderConfig(const VideoEncoderConfig& config) { - return video_.SetDefaultEncoderConfig(config); - } - virtual bool GetOutputVolume(int* level) { return voice_.GetOutputVolume(level); } diff --git a/talk/media/base/videoengine_unittest.h b/talk/media/base/videoengine_unittest.h index c47929102d..d7fa00d558 100644 --- a/talk/media/base/videoengine_unittest.h +++ b/talk/media/base/videoengine_unittest.h @@ -126,327 +126,6 @@ class VideoEngineOverride : public T { } }; -template -class VideoEngineTest : public testing::Test { - protected: - // Tests starting and stopping the engine, and creating a channel. - void StartupShutdown() { - EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); - cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL); - EXPECT_TRUE(channel != NULL); - delete channel; - engine_.Terminate(); - } - - void ConstrainNewCodecBody() { - cricket::VideoCodec empty, in, out; - cricket::VideoCodec max_settings(engine_.codecs()[0].id, - engine_.codecs()[0].name, - 1280, 800, 30, 0); - - // set max settings of 1280x800x30 - EXPECT_TRUE(engine_.SetDefaultEncoderConfig( - cricket::VideoEncoderConfig(max_settings))); - - // don't constrain the max resolution - in = max_settings; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // constrain resolution greater than the max and wider aspect, - // picking best aspect (16:10) - in.width = 1380; - in.height = 800; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 1280, 720, 30); - - // constrain resolution greater than the max and narrow aspect, - // picking best aspect (16:9) - in.width = 1280; - in.height = 740; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 1280, 720, 30); - - // constrain resolution greater than the max, picking equal aspect (4:3) - in.width = 1280; - in.height = 960; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 1280, 800, 30); - - // constrain resolution greater than the max, picking equal aspect (16:10) - in.width = 1280; - in.height = 800; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 1280, 800, 30); - - // reduce max settings to 640x480x30 - max_settings.width = 640; - max_settings.height = 480; - EXPECT_TRUE(engine_.SetDefaultEncoderConfig( - cricket::VideoEncoderConfig(max_settings))); - - // don't constrain the max resolution - in = max_settings; - in.width = 640; - in.height = 480; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // keep 16:10 if they request it - in.height = 400; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // don't constrain lesser 4:3 resolutions - in.width = 320; - in.height = 240; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // don't constrain lesser 16:10 resolutions - in.width = 320; - in.height = 200; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // requested resolution of 0x0 succeeds - in.width = 0; - in.height = 0; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // constrain resolution lesser than the max and wider aspect, - // picking best aspect (16:9) - in.width = 350; - in.height = 201; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 320, 180, 30); - - // constrain resolution greater than the max and narrow aspect, - // picking best aspect (4:3) - in.width = 350; - in.height = 300; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 320, 240, 30); - - // constrain resolution greater than the max and wider aspect, - // picking best aspect (16:9) - in.width = 1380; - in.height = 800; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 360, 30); - - // constrain resolution greater than the max and narrow aspect, - // picking best aspect (4:3) - in.width = 1280; - in.height = 900; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 480, 30); - - // constrain resolution greater than the max, picking equal aspect (4:3) - in.width = 1280; - in.height = 960; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 480, 30); - - // constrain resolution greater than the max, picking equal aspect (16:10) - in.width = 1280; - in.height = 800; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 400, 30); - - // constrain res & fps greater than the max - in.framerate = 50; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 400, 30); - - // reduce max settings to 160x100x10 - max_settings.width = 160; - max_settings.height = 100; - max_settings.framerate = 10; - EXPECT_TRUE(engine_.SetDefaultEncoderConfig( - cricket::VideoEncoderConfig(max_settings))); - - // constrain res & fps to new max - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 160, 100, 10); - - // allow 4:3 "comparable" resolutions - in.width = 160; - in.height = 120; - in.framerate = 10; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 160, 120, 10); - } - - // This is the new way of constraining codec size, where we no longer maintain - // a list of the supported formats. Instead, CanSendCodec will just downscale - // the resolution by 2 until the width is below clamp. - void ConstrainNewCodec2Body() { - cricket::VideoCodec empty, in, out; - cricket::VideoCodec max_settings(engine_.codecs()[0].id, - engine_.codecs()[0].name, - 1280, 800, 30, 0); - - // Set max settings of 1280x800x30 - EXPECT_TRUE(engine_.SetDefaultEncoderConfig( - cricket::VideoEncoderConfig(max_settings))); - - // Don't constrain the max resolution - in = max_settings; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // Constrain resolution greater than the max width. - in.width = 1380; - in.height = 800; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 690, 400, 30); - - // Don't constrain resolution when only the height is greater than max. - in.width = 960; - in.height = 1280; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 960, 1280, 30); - - // Don't constrain smaller format. - in.width = 640; - in.height = 480; - EXPECT_TRUE(engine_.CanSendCodec(in, empty, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 480, 30); - } - - void ConstrainRunningCodecBody() { - cricket::VideoCodec in, out, current; - cricket::VideoCodec max_settings(engine_.codecs()[0].id, - engine_.codecs()[0].name, - 1280, 800, 30, 0); - - // set max settings of 1280x960x30 - EXPECT_TRUE(engine_.SetDefaultEncoderConfig( - cricket::VideoEncoderConfig(max_settings))); - - // establish current call at 1280x800x30 (16:10) - current = max_settings; - current.height = 800; - - // Don't constrain current resolution - in = current; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // requested resolution of 0x0 succeeds - in.width = 0; - in.height = 0; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // Reduce an intermediate resolution down to the next lowest one, preserving - // aspect ratio. - in.width = 800; - in.height = 600; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 400, 30); - - // Clamping by aspect ratio, but still never return a dimension higher than - // requested. - in.width = 1280; - in.height = 720; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 1280, 720, 30); - - in.width = 1279; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 960, 600, 30); - - in.width = 1281; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 1280, 720, 30); - - // Clamp large resolutions down, always preserving aspect - in.width = 1920; - in.height = 1080; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 1280, 800, 30); - - in.width = 1921; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 1280, 800, 30); - - in.width = 1919; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 1280, 800, 30); - - // reduce max settings to 640x480x30 - max_settings.width = 640; - max_settings.height = 480; - EXPECT_TRUE(engine_.SetDefaultEncoderConfig( - cricket::VideoEncoderConfig(max_settings))); - - // establish current call at 640x400x30 (16:10) - current = max_settings; - current.height = 400; - - // Don't constrain current resolution - in = current; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // requested resolution of 0x0 succeeds - in.width = 0; - in.height = 0; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED2(IsEqualCodec, out, in); - - // Reduce an intermediate resolution down to the next lowest one, preserving - // aspect ratio. - in.width = 400; - in.height = 300; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 320, 200, 30); - - // Clamping by aspect ratio, but still never return a dimension higher than - // requested. - in.width = 640; - in.height = 360; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 360, 30); - - in.width = 639; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 480, 300, 30); - - in.width = 641; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 360, 30); - - // Clamp large resolutions down, always preserving aspect - in.width = 1280; - in.height = 800; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 400, 30); - - in.width = 1281; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 400, 30); - - in.width = 1279; - EXPECT_TRUE(engine_.CanSendCodec(in, current, &out)); - EXPECT_PRED4(IsEqualRes, out, 640, 400, 30); - - // Should fail for any that are smaller than our supported formats - in.width = 80; - in.height = 80; - EXPECT_FALSE(engine_.CanSendCodec(in, current, &out)); - - in.height = 50; - EXPECT_FALSE(engine_.CanSendCodec(in, current, &out)); - } - - VideoEngineOverride engine_; - rtc::scoped_ptr video_capturer_; -}; - template class VideoMediaChannelTest : public testing::Test, public sigslot::has_slots<> { diff --git a/talk/media/webrtc/webrtcvideoengine2.cc b/talk/media/webrtc/webrtcvideoengine2.cc index 6b699fe4fb..921e53f316 100644 --- a/talk/media/webrtc/webrtcvideoengine2.cc +++ b/talk/media/webrtc/webrtcvideoengine2.cc @@ -344,18 +344,6 @@ std::vector DefaultVideoCodecList() { return codecs; } -static bool FindFirstMatchingCodec(const std::vector& codecs, - const VideoCodec& requested_codec, - VideoCodec* matching_codec) { - for (size_t i = 0; i < codecs.size(); ++i) { - if (requested_codec.Matches(codecs[i])) { - *matching_codec = codecs[i]; - return true; - } - } - return false; -} - std::vector WebRtcVideoChannel2::WebRtcVideoSendStream::CreateSimulcastVideoStreams( const VideoCodec& codec, @@ -499,29 +487,6 @@ void WebRtcVideoEngine2::Init() { initialized_ = true; } -bool WebRtcVideoEngine2::SetDefaultEncoderConfig( - const VideoEncoderConfig& config) { - const VideoCodec& codec = config.max_codec; - bool supports_codec = false; - for (size_t i = 0; i < video_codecs_.size(); ++i) { - if (CodecNamesEq(video_codecs_[i].name, codec.name)) { - video_codecs_[i].width = codec.width; - video_codecs_[i].height = codec.height; - video_codecs_[i].framerate = codec.framerate; - supports_codec = true; - break; - } - } - - if (!supports_codec) { - LOG(LS_ERROR) << "SetDefaultEncoderConfig, codec not supported: " - << codec.ToString(); - return false; - } - - return true; -} - WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel( webrtc::Call* call, const VideoOptions& options) { @@ -601,48 +566,6 @@ bool WebRtcVideoEngine2::FindCodec(const VideoCodec& in) { return false; } -// Tells whether the |requested| codec can be transmitted or not. If it can be -// transmitted |out| is set with the best settings supported. Aspect ratio will -// be set as close to |current|'s as possible. If not set |requested|'s -// dimensions will be used for aspect ratio matching. -bool WebRtcVideoEngine2::CanSendCodec(const VideoCodec& requested, - const VideoCodec& current, - VideoCodec* out) { - RTC_DCHECK(out != NULL); - - if (requested.width != requested.height && - (requested.height == 0 || requested.width == 0)) { - // 0xn and nx0 are invalid resolutions. - return false; - } - - VideoCodec matching_codec; - if (!FindFirstMatchingCodec(video_codecs_, requested, &matching_codec)) { - // Codec not supported. - return false; - } - - out->id = requested.id; - out->name = requested.name; - out->preference = requested.preference; - out->params = requested.params; - out->framerate = std::min(requested.framerate, matching_codec.framerate); - out->params = requested.params; - out->feedback_params = requested.feedback_params; - out->width = requested.width; - out->height = requested.height; - if (requested.width == 0 && requested.height == 0) { - return true; - } - - while (out->width > matching_codec.width) { - out->width /= 2; - out->height /= 2; - } - - return out->width > 0 && out->height > 0; -} - // Ignore spammy trace messages, mostly from the stats API when we haven't // gotten RTCP info yet from the remote side. bool WebRtcVideoEngine2::ShouldIgnoreTrace(const std::string& trace) { diff --git a/talk/media/webrtc/webrtcvideoengine2.h b/talk/media/webrtc/webrtcvideoengine2.h index 155790c17a..1b8da16368 100644 --- a/talk/media/webrtc/webrtcvideoengine2.h +++ b/talk/media/webrtc/webrtcvideoengine2.h @@ -112,8 +112,6 @@ class WebRtcVideoEngine2 { // Basic video engine implementation. void Init(); - bool SetDefaultEncoderConfig(const VideoEncoderConfig& config); - WebRtcVideoChannel2* CreateChannel(webrtc::Call* call, const VideoOptions& options); @@ -133,9 +131,6 @@ class WebRtcVideoEngine2 { bool EnableTimedRender(); bool FindCodec(const VideoCodec& in); - bool CanSendCodec(const VideoCodec& in, - const VideoCodec& current, - VideoCodec* out); // Check whether the supplied trace should be ignored. bool ShouldIgnoreTrace(const std::string& trace); diff --git a/talk/media/webrtc/webrtcvideoengine2_unittest.cc b/talk/media/webrtc/webrtcvideoengine2_unittest.cc index 24e028e337..74eb93e4bf 100644 --- a/talk/media/webrtc/webrtcvideoengine2_unittest.cc +++ b/talk/media/webrtc/webrtcvideoengine2_unittest.cc @@ -207,26 +207,6 @@ TEST_F(WebRtcVideoEngine2Test, FindCodec) { EXPECT_TRUE(engine_.FindCodec(rtx)); } -TEST_F(WebRtcVideoEngine2Test, SetDefaultEncoderConfigPreservesFeedbackParams) { - cricket::VideoCodec max_settings( - engine_.codecs()[0].id, engine_.codecs()[0].name, - engine_.codecs()[0].width / 2, engine_.codecs()[0].height / 2, 30, 0); - // This codec shouldn't have NACK by default or the test is pointless. - EXPECT_FALSE(max_settings.HasFeedbackParam( - FeedbackParam(kRtcpFbParamNack, kParamValueEmpty))); - // The engine should by default have it however. - EXPECT_TRUE(engine_.codecs()[0].HasFeedbackParam( - FeedbackParam(kRtcpFbParamNack, kParamValueEmpty))); - - // Set constrained max codec settings. - EXPECT_TRUE(engine_.SetDefaultEncoderConfig( - cricket::VideoEncoderConfig(max_settings))); - - // Verify that feedback parameters are retained. - EXPECT_TRUE(engine_.codecs()[0].HasFeedbackParam( - FeedbackParam(kRtcpFbParamNack, kParamValueEmpty))); -} - TEST_F(WebRtcVideoEngine2Test, DefaultRtxCodecHasAssociatedPayloadTypeSet) { std::vector engine_codecs = engine_.codecs(); for (size_t i = 0; i < engine_codecs.size(); ++i) { @@ -795,17 +775,6 @@ TEST_F(WebRtcVideoEngine2Test, RegisterExternalH264DecoderIfSupported) { ASSERT_EQ(1u, decoder_factory.decoders().size()); } -class WebRtcVideoEngine2BaseTest - : public VideoEngineTest { - protected: - typedef VideoEngineTest Base; -}; - -#define WEBRTC_ENGINE_BASE_TEST(test) \ - TEST_F(WebRtcVideoEngine2BaseTest, test) { Base::test##Body(); } - -WEBRTC_ENGINE_BASE_TEST(ConstrainNewCodec2); - class WebRtcVideoChannel2BaseTest : public VideoMediaChannelTest { protected: diff --git a/talk/session/media/channelmanager.cc b/talk/session/media/channelmanager.cc index 115f3b4ea2..e7a4b8bddb 100644 --- a/talk/session/media/channelmanager.cc +++ b/talk/session/media/channelmanager.cc @@ -212,11 +212,6 @@ bool ChannelManager::Init() { << audio_output_volume_; } - // Now apply the default video codec that has been set earlier. - if (default_video_encoder_config_.max_codec.id != 0) { - SetDefaultVideoEncoderConfig(default_video_encoder_config_); - } - return initialized_; } @@ -450,19 +445,6 @@ bool ChannelManager::SetOutputVolume(int level) { return ret; } -bool ChannelManager::SetDefaultVideoEncoderConfig(const VideoEncoderConfig& c) { - bool ret = true; - if (initialized_) { - ret = worker_thread_->Invoke( - Bind(&MediaEngineInterface::SetDefaultVideoEncoderConfig, - media_engine_.get(), c)); - } - if (ret) { - default_video_encoder_config_ = c; - } - return ret; -} - std::vector ChannelManager::GetSupportedFormats( VideoCapturer* capturer) const { ASSERT(capturer != NULL); diff --git a/talk/session/media/channelmanager.h b/talk/session/media/channelmanager.h index a141fe1a2b..2bc516bfaa 100644 --- a/talk/session/media/channelmanager.h +++ b/talk/session/media/channelmanager.h @@ -129,7 +129,6 @@ class ChannelManager : public rtc::MessageHandler, bool GetOutputVolume(int* level); bool SetOutputVolume(int level); - bool SetDefaultVideoEncoderConfig(const VideoEncoderConfig& config); // 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); @@ -228,7 +227,6 @@ class ChannelManager : public rtc::MessageHandler, DataChannels data_channels_; int audio_output_volume_; - VideoEncoderConfig default_video_encoder_config_; VideoRenderer* local_renderer_; bool enable_rtx_; diff --git a/talk/session/media/channelmanager_unittest.cc b/talk/session/media/channelmanager_unittest.cc index e8fb516dd0..4740f0f37d 100644 --- a/talk/session/media/channelmanager_unittest.cc +++ b/talk/session/media/channelmanager_unittest.cc @@ -183,38 +183,6 @@ TEST_F(ChannelManagerTest, NoTransportChannelTest) { cm_->Terminate(); } -// Test that SetDefaultVideoCodec passes through the right values. -TEST_F(ChannelManagerTest, SetDefaultVideoEncoderConfig) { - cricket::VideoCodec codec(96, "G264", 1280, 720, 60, 0); - cricket::VideoEncoderConfig config(codec, 1, 2); - EXPECT_TRUE(cm_->Init()); - EXPECT_TRUE(cm_->SetDefaultVideoEncoderConfig(config)); - EXPECT_EQ(config, fme_->default_video_encoder_config()); -} - -struct GetCapturerFrameSize : public sigslot::has_slots<> { - void OnVideoFrame(VideoCapturer* capturer, const VideoFrame* frame) { - width = frame->GetWidth(); - height = frame->GetHeight(); - } - GetCapturerFrameSize(VideoCapturer* capturer) : width(0), height(0) { - capturer->SignalVideoFrame.connect(this, - &GetCapturerFrameSize::OnVideoFrame); - static_cast(capturer)->CaptureFrame(); - } - size_t width; - size_t height; -}; - -// Test that SetDefaultVideoCodec passes through the right values. -TEST_F(ChannelManagerTest, SetDefaultVideoCodecBeforeInit) { - cricket::VideoCodec codec(96, "G264", 1280, 720, 60, 0); - cricket::VideoEncoderConfig config(codec, 1, 2); - EXPECT_TRUE(cm_->SetDefaultVideoEncoderConfig(config)); - EXPECT_TRUE(cm_->Init()); - EXPECT_EQ(config, fme_->default_video_encoder_config()); -} - TEST_F(ChannelManagerTest, GetSetOutputVolumeBeforeInit) { int level; // Before init, SetOutputVolume() remembers the volume but does not change the