OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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_TEST_VIDEO_CODEC_TEST_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TEST_H_ |
12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TEST_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TEST_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/api/video_codecs/video_decoder.h" | 16 #include "webrtc/api/video_codecs/video_decoder.h" |
17 #include "webrtc/api/video_codecs/video_encoder.h" | 17 #include "webrtc/api/video_codecs/video_encoder.h" |
18 #include "webrtc/base/criticalsection.h" | 18 #include "webrtc/base/criticalsection.h" |
19 #include "webrtc/base/event.h" | 19 #include "webrtc/base/event.h" |
20 #include "webrtc/base/thread_annotations.h" | 20 #include "webrtc/base/thread_annotations.h" |
| 21 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
21 #include "webrtc/test/gtest.h" | 22 #include "webrtc/test/gtest.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 | 25 |
25 class VideoCodecTest : public ::testing::Test { | 26 class VideoCodecTest : public ::testing::Test { |
26 public: | 27 public: |
27 VideoCodecTest() | 28 VideoCodecTest() |
28 : encode_complete_callback_(this), | 29 : encode_complete_callback_(this), |
29 decode_complete_callback_(this), | 30 decode_complete_callback_(this), |
30 encoded_frame_event_(false /* manual reset */, | 31 encoded_frame_event_(false /* manual reset */, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 private: | 65 private: |
65 VideoCodecTest* const test_; | 66 VideoCodecTest* const test_; |
66 }; | 67 }; |
67 | 68 |
68 virtual VideoEncoder* CreateEncoder() = 0; | 69 virtual VideoEncoder* CreateEncoder() = 0; |
69 virtual VideoDecoder* CreateDecoder() = 0; | 70 virtual VideoDecoder* CreateDecoder() = 0; |
70 virtual VideoCodec codec_settings() = 0; | 71 virtual VideoCodec codec_settings() = 0; |
71 | 72 |
72 void SetUp() override; | 73 void SetUp() override; |
73 | 74 |
74 bool WaitForEncodedFrame(EncodedImage* frame); | 75 bool WaitForEncodedFrame(EncodedImage* frame, |
| 76 CodecSpecificInfo* codec_specific_info); |
75 bool WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame, | 77 bool WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame, |
76 rtc::Optional<uint8_t>* qp); | 78 rtc::Optional<uint8_t>* qp); |
77 | 79 |
| 80 // Populated by InitCodecs(). |
| 81 VideoCodec codec_settings_; |
| 82 |
78 std::unique_ptr<VideoFrame> input_frame_; | 83 std::unique_ptr<VideoFrame> input_frame_; |
79 | 84 |
80 std::unique_ptr<VideoEncoder> encoder_; | 85 std::unique_ptr<VideoEncoder> encoder_; |
81 std::unique_ptr<VideoDecoder> decoder_; | 86 std::unique_ptr<VideoDecoder> decoder_; |
82 | 87 |
83 private: | 88 private: |
84 void InitCodecs(); | 89 void InitCodecs(); |
85 | 90 |
86 FakeEncodeCompleteCallback encode_complete_callback_; | 91 FakeEncodeCompleteCallback encode_complete_callback_; |
87 FakeDecodeCompleteCallback decode_complete_callback_; | 92 FakeDecodeCompleteCallback decode_complete_callback_; |
88 | 93 |
89 rtc::Event encoded_frame_event_; | 94 rtc::Event encoded_frame_event_; |
90 rtc::CriticalSection encoded_frame_section_; | 95 rtc::CriticalSection encoded_frame_section_; |
91 rtc::Optional<EncodedImage> encoded_frame_ GUARDED_BY(encoded_frame_section_); | 96 rtc::Optional<EncodedImage> encoded_frame_ GUARDED_BY(encoded_frame_section_); |
| 97 CodecSpecificInfo codec_specific_info_ GUARDED_BY(encoded_frame_section_); |
92 | 98 |
93 rtc::Event decoded_frame_event_; | 99 rtc::Event decoded_frame_event_; |
94 rtc::CriticalSection decoded_frame_section_; | 100 rtc::CriticalSection decoded_frame_section_; |
95 rtc::Optional<VideoFrame> decoded_frame_ GUARDED_BY(decoded_frame_section_); | 101 rtc::Optional<VideoFrame> decoded_frame_ GUARDED_BY(decoded_frame_section_); |
96 rtc::Optional<uint8_t> decoded_qp_ GUARDED_BY(decoded_frame_section_); | 102 rtc::Optional<uint8_t> decoded_qp_ GUARDED_BY(decoded_frame_section_); |
97 }; | 103 }; |
98 | 104 |
99 } // namespace webrtc | 105 } // namespace webrtc |
100 | 106 |
101 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TEST_H_ | 107 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TEST_H_ |
OLD | NEW |