Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc

Issue 1306813009: H.264 video codec support using OpenH264/FFmpeg (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Misc (WebRtcVideoChannel2::...::ConfigureVideoEncoderSettings care about H264 case) Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc
diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc
index 6c0e1254fcaded68b1259d844dfcbd31d480886d..ccf21640749e99b4d8ea5e0b8e211664418fe2b0 100644
--- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc
+++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc
@@ -15,9 +15,10 @@
#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/h264/include/h264.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
-#include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
+#include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
#include "webrtc/test/testsupport/fileutils.h"
#include "webrtc/test/testsupport/frame_reader.h"
@@ -152,7 +153,11 @@ class VideoProcessorIntegrationTest: public testing::Test {
virtual ~VideoProcessorIntegrationTest() {}
void SetUpCodecConfig() {
- if (codec_type_ == kVideoCodecVP8) {
+ if (codec_type_ == kVideoCodecH264) {
+ encoder_ = H264Encoder::Create();
+ decoder_ = H264Decoder::Create();
+ VideoCodingModule::Codec(kVideoCodecH264, &codec_settings_);
+ } else if (codec_type_ == kVideoCodecVP8) {
encoder_ = VP8Encoder::Create();
decoder_ = VP8Decoder::Create();
VideoCodingModule::Codec(kVideoCodecVP8, &codec_settings_);
@@ -187,6 +192,12 @@ class VideoProcessorIntegrationTest: public testing::Test {
// These features may be set depending on the test.
switch (config_.codec_settings->codecType) {
+ case kVideoCodecH264:
+ config_.codec_settings->codecSpecific.H264.frameDroppingOn =
+ frame_dropper_on_;
+ config_.codec_settings->codecSpecific.H264.keyFrameInterval =
+ kBaseKeyFrameInterval;
+ break;
case kVideoCodecVP8:
config_.codec_settings->codecSpecific.VP8.errorConcealmentOn =
error_concealment_on_;
@@ -214,7 +225,7 @@ class VideoProcessorIntegrationTest: public testing::Test {
default:
assert(false);
break;
- }
+ }
frame_reader_ =
new webrtc::test::FrameReaderImpl(config_.input_filename,
config_.frame_length_in_bytes);
@@ -588,6 +599,37 @@ void SetRateControlMetrics(RateControlMetrics* rc_metrics,
rc_metrics[update_index].num_spatial_resizes = num_spatial_resizes;
}
+#if defined(WEBRTC_OPENH264)
+
+// H264: Run with no packet loss and fixed bitrate. Quality should be very high.
+// Note(hbos): The PacketManipulatorImpl code used to simulate packet loss in
+// these unittests appears to drop "packets" in a way that is not compatible
+// with H264. Therefore ProcessXPercentPacketLossH264, X != 0, unittests have
+// not been added.
+TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossH264) {
+ // Bitrate and frame rate profile.
+ RateProfile rate_profile;
+ SetRateProfilePars(&rate_profile, 0, 500, 30, 0);
+ rate_profile.frame_index_rate_update[1] = kNbrFramesShort + 1;
+ rate_profile.num_frames = kNbrFramesShort;
+ // Codec/network settings.
+ CodecConfigPars process_settings;
+ SetCodecParameters(&process_settings, kVideoCodecH264, 0.0f, -1, 1, false,
+ false, true, false);
+ // Metrics for expected quality.
+ QualityMetrics quality_metrics;
+ SetQualityMetrics(&quality_metrics, 35.0, 34.0, 0.93, 0.92);
+ // Metrics for rate control.
+ RateControlMetrics rc_metrics[1];
+ SetRateControlMetrics(rc_metrics, 0, 0, 60, 20, 10, 20, 0);
+ ProcessFramesAndVerify(quality_metrics,
+ rate_profile,
+ process_settings,
+ rc_metrics);
+}
+
+#endif // defined(WEBRTC_OPENH264)
+
// VP9: Run with no packet loss and fixed bitrate. Quality should be very high.
// One key frame (first frame only) in sequence. Setting |key_frame_interval|
// to -1 below means no periodic key frames in test.

Powered by Google App Engine
This is Rietveld 408576698