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 "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "webrtc/base/checks.h" |
14 #include "webrtc/base/scoped_ptr.h" | 15 #include "webrtc/base/scoped_ptr.h" |
15 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 16 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 17 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
17 #include "webrtc/system_wrappers/include/tick_util.h" | 18 #include "webrtc/system_wrappers/include/tick_util.h" |
18 #include "webrtc/test/testsupport/fileutils.h" | 19 #include "webrtc/test/testsupport/fileutils.h" |
19 #include "webrtc/test/testsupport/gtest_disable.h" | 20 #include "webrtc/test/testsupport/gtest_disable.h" |
20 | 21 |
21 namespace webrtc { | 22 namespace webrtc { |
22 | 23 |
23 enum { kMaxWaitEncTimeMs = 100 }; | 24 enum { kMaxWaitEncTimeMs = 100 }; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 encode_complete_ = false; | 72 encode_complete_ = false; |
72 return true; | 73 return true; |
73 } | 74 } |
74 return false; | 75 return false; |
75 } | 76 } |
76 | 77 |
77 class Vp8UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback { | 78 class Vp8UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback { |
78 public: | 79 public: |
79 explicit Vp8UnitTestDecodeCompleteCallback(VideoFrame* frame) | 80 explicit Vp8UnitTestDecodeCompleteCallback(VideoFrame* frame) |
80 : decoded_frame_(frame), decode_complete(false) {} | 81 : decoded_frame_(frame), decode_complete(false) {} |
81 int Decoded(webrtc::VideoFrame& frame); | 82 int32_t Decoded(VideoFrame& frame) override; |
| 83 int32_t Decoded(VideoFrame& frame, int64_t decode_time_ms) override { |
| 84 RTC_NOTREACHED(); |
| 85 return -1; |
| 86 } |
82 bool DecodeComplete(); | 87 bool DecodeComplete(); |
83 | 88 |
84 private: | 89 private: |
85 VideoFrame* decoded_frame_; | 90 VideoFrame* decoded_frame_; |
86 bool decode_complete; | 91 bool decode_complete; |
87 }; | 92 }; |
88 | 93 |
89 bool Vp8UnitTestDecodeCompleteCallback::DecodeComplete() { | 94 bool Vp8UnitTestDecodeCompleteCallback::DecodeComplete() { |
90 if (decode_complete) { | 95 if (decode_complete) { |
91 decode_complete = false; | 96 decode_complete = false; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 269 |
265 EXPECT_EQ(0, decoder_->Decode(encoded_frame_, false, NULL)); | 270 EXPECT_EQ(0, decoder_->Decode(encoded_frame_, false, NULL)); |
266 rtc::scoped_ptr<uint8_t[]> second_frame_buffer(new uint8_t[length]); | 271 rtc::scoped_ptr<uint8_t[]> second_frame_buffer(new uint8_t[length]); |
267 ExtractBuffer(decoded_frame_, length, second_frame_buffer.get()); | 272 ExtractBuffer(decoded_frame_, length, second_frame_buffer.get()); |
268 | 273 |
269 EXPECT_EQ( | 274 EXPECT_EQ( |
270 0, memcmp(second_frame_buffer.get(), first_frame_buffer.get(), length)); | 275 0, memcmp(second_frame_buffer.get(), first_frame_buffer.get(), length)); |
271 } | 276 } |
272 | 277 |
273 } // namespace webrtc | 278 } // namespace webrtc |
OLD | NEW |