OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ |
12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ |
13 | 13 |
14 #include <algorithm> | 14 #include <algorithm> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
| 17 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/scoped_ptr.h" |
18 #include "webrtc/common.h" | 19 #include "webrtc/common.h" |
19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
20 #include "webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_int
erface.h" | 21 #include "webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_int
erface.h" |
21 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 22 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
22 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" | 23 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" |
23 #include "webrtc/video_frame.h" | 24 #include "webrtc/video_frame.h" |
24 | 25 |
25 #include "gtest/gtest.h" | 26 #include "gtest/gtest.h" |
26 | 27 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 int picture_id_; | 117 int picture_id_; |
117 int temporal_layer_[kNumberOfSimulcastStreams]; | 118 int temporal_layer_[kNumberOfSimulcastStreams]; |
118 bool layer_sync_[kNumberOfSimulcastStreams]; | 119 bool layer_sync_[kNumberOfSimulcastStreams]; |
119 }; | 120 }; |
120 | 121 |
121 class Vp8TestDecodedImageCallback : public DecodedImageCallback { | 122 class Vp8TestDecodedImageCallback : public DecodedImageCallback { |
122 public: | 123 public: |
123 Vp8TestDecodedImageCallback() | 124 Vp8TestDecodedImageCallback() |
124 : decoded_frames_(0) { | 125 : decoded_frames_(0) { |
125 } | 126 } |
126 virtual int32_t Decoded(VideoFrame& decoded_image) { | 127 int32_t Decoded(VideoFrame& decoded_image) override { |
127 for (int i = 0; i < decoded_image.width(); ++i) { | 128 for (int i = 0; i < decoded_image.width(); ++i) { |
128 EXPECT_NEAR(kColorY, decoded_image.buffer(kYPlane)[i], 1); | 129 EXPECT_NEAR(kColorY, decoded_image.buffer(kYPlane)[i], 1); |
129 } | 130 } |
130 | 131 |
131 // TODO(mikhal): Verify the difference between U,V and the original. | 132 // TODO(mikhal): Verify the difference between U,V and the original. |
132 for (int i = 0; i < ((decoded_image.width() + 1) / 2); ++i) { | 133 for (int i = 0; i < ((decoded_image.width() + 1) / 2); ++i) { |
133 EXPECT_NEAR(kColorU, decoded_image.buffer(kUPlane)[i], 4); | 134 EXPECT_NEAR(kColorU, decoded_image.buffer(kUPlane)[i], 4); |
134 EXPECT_NEAR(kColorV, decoded_image.buffer(kVPlane)[i], 4); | 135 EXPECT_NEAR(kColorV, decoded_image.buffer(kVPlane)[i], 4); |
135 } | 136 } |
136 decoded_frames_++; | 137 decoded_frames_++; |
137 return 0; | 138 return 0; |
138 } | 139 } |
| 140 int32_t Decoded(VideoFrame& decoded_image, int64_t decode_time_ms) override { |
| 141 RTC_NOTREACHED(); |
| 142 return -1; |
| 143 } |
139 int DecodedFrames() { | 144 int DecodedFrames() { |
140 return decoded_frames_; | 145 return decoded_frames_; |
141 } | 146 } |
142 | 147 |
143 private: | 148 private: |
144 int decoded_frames_; | 149 int decoded_frames_; |
145 }; | 150 }; |
146 | 151 |
147 class SkipEncodingUnusedStreamsTest { | 152 class SkipEncodingUnusedStreamsTest { |
148 public: | 153 public: |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 rtc::scoped_ptr<VP8Decoder> decoder_; | 996 rtc::scoped_ptr<VP8Decoder> decoder_; |
992 MockDecodedImageCallback decoder_callback_; | 997 MockDecodedImageCallback decoder_callback_; |
993 VideoCodec settings_; | 998 VideoCodec settings_; |
994 VideoFrame input_frame_; | 999 VideoFrame input_frame_; |
995 }; | 1000 }; |
996 | 1001 |
997 } // namespace testing | 1002 } // namespace testing |
998 } // namespace webrtc | 1003 } // namespace webrtc |
999 | 1004 |
1000 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ | 1005 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ |
OLD | NEW |