diff --git a/webrtc/common_types.h b/webrtc/common_types.h index 492cb37f52..3c79137d74 100644 --- a/webrtc/common_types.h +++ b/webrtc/common_types.h @@ -530,6 +530,7 @@ struct VideoCodecVP8 bool errorConcealmentOn; bool automaticResizeOn; bool frameDroppingOn; + int keyFrameInterval; }; // Unknown specific diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc index 102fa82be4..f0842df60c 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc @@ -8,22 +8,22 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "gtest/gtest.h" - #include -#include "modules/video_coding/codecs/interface/video_codec_interface.h" -#include "modules/video_coding/codecs/test/packet_manipulator.h" -#include "modules/video_coding/codecs/test/videoprocessor.h" -#include "modules/video_coding/codecs/vp8/include/vp8.h" -#include "modules/video_coding/codecs/vp8/include/vp8_common_types.h" -#include "modules/video_coding/main/interface/video_coding.h" -#include "testsupport/fileutils.h" -#include "testsupport/frame_reader.h" -#include "testsupport/frame_writer.h" -#include "testsupport/metrics/video_metrics.h" -#include "testsupport/packet_reader.h" -#include "typedefs.h" +#include "gtest/gtest.h" + +#include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h" +#include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" +#include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" +#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" +#include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" +#include "webrtc/modules/video_coding/main/interface/video_coding.h" +#include "webrtc/test/testsupport/fileutils.h" +#include "webrtc/test/testsupport/frame_reader.h" +#include "webrtc/test/testsupport/frame_writer.h" +#include "webrtc/test/testsupport/metrics/video_metrics.h" +#include "webrtc/test/testsupport/packet_reader.h" +#include "webrtc/typedefs.h" namespace webrtc { @@ -32,6 +32,7 @@ namespace webrtc { const int kMaxNumRateUpdates = 3; const int kPercTargetvsActualMismatch = 20; +const int kBaseKeyFrameInterval = 3000; // Codec and network settings. struct CodecConfigPars { @@ -182,6 +183,8 @@ class VideoProcessorIntegrationTest: public testing::Test { frame_dropper_on_; config_.codec_settings->codecSpecific.VP8.automaticResizeOn = spatial_resize_on_; + config_.codec_settings->codecSpecific.VP8.keyFrameInterval = + kBaseKeyFrameInterval; frame_reader_ = new webrtc::test::FrameReaderImpl(config_.input_filename, diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc index 324e3a268e..3fbe7f4787 100644 --- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc +++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc @@ -11,23 +11,24 @@ * */ -#include "modules/video_coding/codecs/vp8/vp8_impl.h" +#include "webrtc/modules/video_coding/codecs/vp8/vp8_impl.h" #include #include #include +#include #include "vpx/vpx_encoder.h" #include "vpx/vpx_decoder.h" #include "vpx/vp8cx.h" #include "vpx/vp8dx.h" -#include "common_video/libyuv/include/webrtc_libyuv.h" -#include "module_common_types.h" -#include "modules/video_coding/codecs/vp8/reference_picture_selection.h" -#include "modules/video_coding/codecs/vp8/temporal_layers.h" -#include "system_wrappers/interface/tick_util.h" -#include "system_wrappers/interface/trace_event.h" +#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" +#include "webrtc/modules/interface/module_common_types.h" +#include "webrtc/modules/video_coding/codecs/vp8/reference_picture_selection.h" +#include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" +#include "webrtc/system_wrappers/interface/tick_util.h" +#include "webrtc/system_wrappers/interface/trace_event.h" enum { kVp8ErrorPropagationTh = 30 }; @@ -251,9 +252,11 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst, // Disable periodic key frames if we get feedback from the decoder // through SLI and RPSI. config_->kf_mode = VPX_KF_DISABLED; - } else { + } else if (inst->codecSpecific.VP8.keyFrameInterval > 0) { config_->kf_mode = VPX_KF_AUTO; - config_->kf_max_dist = 3000; + config_->kf_max_dist = inst->codecSpecific.VP8.keyFrameInterval; + } else { + config_->kf_mode = VPX_KF_DISABLED; } switch (inst->codecSpecific.VP8.complexity) { case kComplexityHigh: diff --git a/webrtc/modules/video_coding/main/source/codec_database.cc b/webrtc/modules/video_coding/main/source/codec_database.cc index 2953e0215c..a61ec1de04 100644 --- a/webrtc/modules/video_coding/main/source/codec_database.cc +++ b/webrtc/modules/video_coding/main/source/codec_database.cc @@ -8,19 +8,19 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "modules/video_coding/main/source/codec_database.h" +#include "webrtc/modules/video_coding/main/source/codec_database.h" #include -#include "engine_configurations.h" +#include "webrtc/engine_configurations.h" #ifdef VIDEOCODEC_I420 -#include "modules/video_coding/codecs/i420/main/interface/i420.h" +#include "webrtc/modules/video_coding/codecs/i420/main/interface/i420.h" #endif #ifdef VIDEOCODEC_VP8 -#include "modules/video_coding/codecs/vp8/include/vp8.h" +#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" #endif -#include "modules/video_coding/main/source/internal_defines.h" -#include "system_wrappers/interface/trace.h" +#include "webrtc/modules/video_coding/main/source/internal_defines.h" +#include "webrtc/system_wrappers/interface/trace.h" namespace webrtc { @@ -98,6 +98,7 @@ bool VCMCodecDataBase::Codec(int list_id, settings->codecSpecific.VP8.errorConcealmentOn = false; settings->codecSpecific.VP8.automaticResizeOn = false; settings->codecSpecific.VP8.frameDroppingOn = true; + settings->codecSpecific.VP8.keyFrameInterval = 3000; return true; } #endif diff --git a/webrtc/video_engine/test/auto_test/source/vie_autotest_codec.cc b/webrtc/video_engine/test/auto_test/source/vie_autotest_codec.cc index 6c0e1a47e1..87169a63a6 100644 --- a/webrtc/video_engine/test/auto_test/source/vie_autotest_codec.cc +++ b/webrtc/video_engine/test/auto_test/source/vie_autotest_codec.cc @@ -453,6 +453,7 @@ void ViEAutoTest::ViECodecAPITest() { if (video_codec.codecType == webrtc::kVideoCodecVP8) { video_codec.codecSpecific.VP8.automaticResizeOn = true; video_codec.codecSpecific.VP8.frameDroppingOn = true; + video_codec.codecSpecific.VP8.keyFrameInterval = 300; EXPECT_EQ(0, codec->SetSendCodec(video_channel, video_codec)); break; } @@ -462,12 +463,11 @@ void ViEAutoTest::ViECodecAPITest() { EXPECT_EQ(webrtc::kVideoCodecVP8, video_codec.codecType); EXPECT_TRUE(video_codec.codecSpecific.VP8.automaticResizeOn); EXPECT_TRUE(video_codec.codecSpecific.VP8.frameDroppingOn); + EXPECT_EQ(300, video_codec.codecSpecific.VP8.keyFrameInterval); for (int i = 0; i < number_of_codecs; i++) { EXPECT_EQ(0, codec->GetCodec(i, video_codec)); if (video_codec.codecType == webrtc::kVideoCodecI420) { - video_codec.codecSpecific.VP8.automaticResizeOn = false; - video_codec.codecSpecific.VP8.frameDroppingOn = false; EXPECT_EQ(0, codec->SetSendCodec(video_channel, video_codec)); break; } @@ -475,8 +475,6 @@ void ViEAutoTest::ViECodecAPITest() { memset(&video_codec, 0, sizeof(video_codec)); EXPECT_EQ(0, codec->GetSendCodec(video_channel, video_codec)); EXPECT_EQ(webrtc::kVideoCodecI420, video_codec.codecType); - EXPECT_FALSE(video_codec.codecSpecific.VP8.automaticResizeOn); - EXPECT_FALSE(video_codec.codecSpecific.VP8.frameDroppingOn); EXPECT_EQ(0, base->DeleteChannel(video_channel)); diff --git a/webrtc/video_engine/vie_codec_impl.cc b/webrtc/video_engine/vie_codec_impl.cc index 3ae15c70e4..0ace1e2b93 100644 --- a/webrtc/video_engine/vie_codec_impl.cc +++ b/webrtc/video_engine/vie_codec_impl.cc @@ -124,12 +124,14 @@ int ViECodecImpl::SetSendCodec(const int video_channel, WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(shared_data_->instance_id(), video_channel), "pictureLossIndicationOn: %d, feedbackModeOn: %d, " - "complexity: %d, resilience: %d, numberOfTemporalLayers: %u", + "complexity: %d, resilience: %d, numberOfTemporalLayers: %u" + "keyFrameInterval %d", video_codec.codecSpecific.VP8.pictureLossIndicationOn, video_codec.codecSpecific.VP8.feedbackModeOn, video_codec.codecSpecific.VP8.complexity, video_codec.codecSpecific.VP8.resilience, - video_codec.codecSpecific.VP8.numberOfTemporalLayers); + video_codec.codecSpecific.VP8.numberOfTemporalLayers, + video_codec.codecSpecific.VP8.keyFrameInterval); } if (!CodecValid(video_codec)) { // Error logged.