| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <stdio.h> | 11 #include <stdio.h> |
| 12 | 12 |
| 13 #include <memory> | 13 #include <memory> |
| 14 | 14 |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
| 17 #include "webrtc/base/timeutils.h" |
| 17 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 18 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 19 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
| 19 #include "webrtc/system_wrappers/include/tick_util.h" | |
| 20 #include "webrtc/test/testsupport/fileutils.h" | 20 #include "webrtc/test/testsupport/fileutils.h" |
| 21 | 21 |
| 22 namespace webrtc { | 22 namespace webrtc { |
| 23 | 23 |
| 24 enum { kMaxWaitEncTimeMs = 100 }; | 24 enum { kMaxWaitEncTimeMs = 100 }; |
| 25 enum { kMaxWaitDecTimeMs = 25 }; | 25 enum { kMaxWaitDecTimeMs = 25 }; |
| 26 | 26 |
| 27 static const uint32_t kTestTimestamp = 123; | 27 static const uint32_t kTestTimestamp = 123; |
| 28 static const int64_t kTestNtpTimeMs = 456; | 28 static const int64_t kTestNtpTimeMs = 456; |
| 29 | 29 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 codec_inst_.maxBitrate = 4000; | 152 codec_inst_.maxBitrate = 4000; |
| 153 codec_inst_.qpMax = 56; | 153 codec_inst_.qpMax = 56; |
| 154 codec_inst_.codecSpecific.VP8.denoisingOn = true; | 154 codec_inst_.codecSpecific.VP8.denoisingOn = true; |
| 155 | 155 |
| 156 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 156 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 157 encoder_->InitEncode(&codec_inst_, 1, 1440)); | 157 encoder_->InitEncode(&codec_inst_, 1, 1440)); |
| 158 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_inst_, 1)); | 158 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_inst_, 1)); |
| 159 } | 159 } |
| 160 | 160 |
| 161 size_t WaitForEncodedFrame() const { | 161 size_t WaitForEncodedFrame() const { |
| 162 int64_t startTime = TickTime::MillisecondTimestamp(); | 162 int64_t startTime = rtc::TimeMillis(); |
| 163 while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs) { | 163 while (rtc::TimeMillis() - startTime < kMaxWaitEncTimeMs) { |
| 164 if (encode_complete_callback_->EncodeComplete()) { | 164 if (encode_complete_callback_->EncodeComplete()) { |
| 165 return encoded_frame_._length; | 165 return encoded_frame_._length; |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 return 0; | 168 return 0; |
| 169 } | 169 } |
| 170 | 170 |
| 171 size_t WaitForDecodedFrame() const { | 171 size_t WaitForDecodedFrame() const { |
| 172 int64_t startTime = TickTime::MillisecondTimestamp(); | 172 int64_t startTime = rtc::TimeMillis(); |
| 173 while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitDecTimeMs) { | 173 while (rtc::TimeMillis() - startTime < kMaxWaitDecTimeMs) { |
| 174 if (decode_complete_callback_->DecodeComplete()) { | 174 if (decode_complete_callback_->DecodeComplete()) { |
| 175 return CalcBufferSize(kI420, decoded_frame_.width(), | 175 return CalcBufferSize(kI420, decoded_frame_.width(), |
| 176 decoded_frame_.height()); | 176 decoded_frame_.height()); |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 return 0; | 179 return 0; |
| 180 } | 180 } |
| 181 | 181 |
| 182 const int kWidth = 172; | 182 const int kWidth = 172; |
| 183 const int kHeight = 144; | 183 const int kHeight = 144; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, | 261 EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR, |
| 262 decoder_->Decode(encoded_frame_, false, NULL)); | 262 decoder_->Decode(encoded_frame_, false, NULL)); |
| 263 // Now setting a key frame. | 263 // Now setting a key frame. |
| 264 encoded_frame_._frameType = kVideoFrameKey; | 264 encoded_frame_._frameType = kVideoFrameKey; |
| 265 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 265 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 266 decoder_->Decode(encoded_frame_, false, NULL)); | 266 decoder_->Decode(encoded_frame_, false, NULL)); |
| 267 EXPECT_GT(I420PSNR(&input_frame_, &decoded_frame_), 36); | 267 EXPECT_GT(I420PSNR(&input_frame_, &decoded_frame_), 36); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace webrtc | 270 } // namespace webrtc |
| OLD | NEW |