From 20b294c28e86899a0b44938d0d30682ff6439ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Kalliom=C3=A4ki?= Date: Tue, 12 Dec 2017 16:37:16 +0100 Subject: [PATCH] Android: Re-enable videoprocessor integration tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The problem was that the encoder was feeded with frames that had 0 as a timestamp. This confused the encoder. H264 high profile support clause was also wrong and is corrected. Bug: webrtc:8601 Change-Id: Ic5a893b4b7573e694f865b63620843b2c9aa489f Reviewed-on: https://webrtc-review.googlesource.com/32300 Reviewed-by: Magnus Jedvert Reviewed-by: Rasmus Brandt Commit-Queue: Sami Kalliomäki Cr-Commit-Position: refs/heads/master@{#21234} --- modules/video_coding/codecs/test/videoprocessor.cc | 5 +++-- .../test/videoprocessor_integrationtest_mediacodec.cc | 7 ++----- .../api/org/webrtc/HardwareVideoEncoderFactory.java | 3 ++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/video_coding/codecs/test/videoprocessor.cc b/modules/video_coding/codecs/test/videoprocessor.cc index 20cb0cffbd..06475e196d 100644 --- a/modules/video_coding/codecs/test/videoprocessor.cc +++ b/modules/video_coding/codecs/test/videoprocessor.cc @@ -30,7 +30,6 @@ namespace test { namespace { const int kRtpClockRateHz = 90000; -const int64_t kNoRenderTime = 0; std::unique_ptr CreateBitrateAllocator( TestConfig* config) { @@ -166,9 +165,11 @@ void VideoProcessor::ProcessFrame() { // want to use capture timestamps in the IVF files. const uint32_t rtp_timestamp = (frame_number + 1) * kRtpClockRateHz / config_.codec_settings.maxFramerate; + const int64_t render_time_ms = (frame_number + 1) * rtc::kNumMillisecsPerSec / + config_.codec_settings.maxFramerate; rtp_timestamp_to_frame_num_[rtp_timestamp] = frame_number; input_frames_[frame_number] = rtc::MakeUnique( - buffer, rtp_timestamp, kNoRenderTime, webrtc::kVideoRotation_0); + buffer, rtp_timestamp, render_time_ms, webrtc::kVideoRotation_0); std::vector frame_types = config_.FrameTypeForFrame(frame_number); diff --git a/modules/video_coding/codecs/test/videoprocessor_integrationtest_mediacodec.cc b/modules/video_coding/codecs/test/videoprocessor_integrationtest_mediacodec.cc index 3793ea1ee9..7f6b40b0b9 100644 --- a/modules/video_coding/codecs/test/videoprocessor_integrationtest_mediacodec.cc +++ b/modules/video_coding/codecs/test/videoprocessor_integrationtest_mediacodec.cc @@ -40,8 +40,7 @@ class VideoProcessorIntegrationTestMediaCodec } }; -// TODO(bugs.webrtc.org/8601): Fix HW encoder and re-enable. -TEST_F(VideoProcessorIntegrationTestMediaCodec, DISABLED_ForemanCif500kbpsVp8) { +TEST_F(VideoProcessorIntegrationTestMediaCodec, ForemanCif500kbpsVp8) { config_.SetCodecSettings(kVideoCodecVP8, 1, false, false, false, false, false, 352, 288); @@ -60,9 +59,7 @@ TEST_F(VideoProcessorIntegrationTestMediaCodec, DISABLED_ForemanCif500kbpsVp8) { kNoVisualizationParams); } -// TODO(bugs.webrtc.org/8601): Fix HW encoder and re-enable. -TEST_F(VideoProcessorIntegrationTestMediaCodec, - DISABLED_ForemanCif500kbpsH264CBP) { +TEST_F(VideoProcessorIntegrationTestMediaCodec, ForemanCif500kbpsH264CBP) { config_.encoded_frame_checker = &h264_keyframe_checker_; config_.SetCodecSettings(kVideoCodecH264, 1, false, false, false, false, false, 352, 288); diff --git a/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java b/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java index 25b7c77e73..ef25a8c908 100644 --- a/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java +++ b/sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java @@ -259,7 +259,8 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory { } private boolean isH264HighProfileSupported(MediaCodecInfo info) { - return enableH264HighProfile && info.getName().startsWith(QCOM_PREFIX); + return enableH264HighProfile && Build.VERSION.SDK_INT > Build.VERSION_CODES.M + && info.getName().startsWith(EXYNOS_PREFIX); } private Map getCodecProperties(VideoCodecType type, boolean highProfile) {