Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: webrtc/video/video_decoder_unittest.cc

Issue 1406903002: Expose codec implementation names in stats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/video_decoder.cc ('k') | webrtc/video/video_encoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 int32_t Release() override { 47 int32_t Release() override {
48 ++release_count_; 48 ++release_count_;
49 return WEBRTC_VIDEO_CODEC_OK; 49 return WEBRTC_VIDEO_CODEC_OK;
50 } 50 }
51 51
52 int32_t Reset() override { 52 int32_t Reset() override {
53 ++reset_count_; 53 ++reset_count_;
54 return WEBRTC_VIDEO_CODEC_OK; 54 return WEBRTC_VIDEO_CODEC_OK;
55 } 55 }
56
57 const char* ImplementationName() const override {
58 return "fake-decoder";
59 }
60
56 int init_decode_count_ = 0; 61 int init_decode_count_ = 0;
57 int decode_count_ = 0; 62 int decode_count_ = 0;
58 int32_t decode_return_code_ = WEBRTC_VIDEO_CODEC_OK; 63 int32_t decode_return_code_ = WEBRTC_VIDEO_CODEC_OK;
59 DecodedImageCallback* decode_complete_callback_ = nullptr; 64 DecodedImageCallback* decode_complete_callback_ = nullptr;
60 int release_count_ = 0; 65 int release_count_ = 0;
61 int reset_count_ = 0; 66 int reset_count_ = 0;
62 }; 67 };
63 CountingFakeDecoder fake_decoder_; 68 CountingFakeDecoder fake_decoder_;
64 VideoDecoderSoftwareFallbackWrapper fallback_wrapper_; 69 VideoDecoderSoftwareFallbackWrapper fallback_wrapper_;
65 }; 70 };
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 142
138 fake_decoder_.decode_return_code_ = WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; 143 fake_decoder_.decode_return_code_ = WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
139 EncodedImage encoded_image; 144 EncodedImage encoded_image;
140 fallback_wrapper_.Decode(encoded_image, false, nullptr, nullptr, -1); 145 fallback_wrapper_.Decode(encoded_image, false, nullptr, nullptr, -1);
141 fallback_wrapper_.Reset(); 146 fallback_wrapper_.Reset();
142 EXPECT_EQ(2, fake_decoder_.reset_count_) 147 EXPECT_EQ(2, fake_decoder_.reset_count_)
143 << "Reset not forwarded during fallback."; 148 << "Reset not forwarded during fallback.";
144 } 149 }
145 150
146 // TODO(pbos): Fake a VP8 frame well enough to actually receive a callback from 151 // TODO(pbos): Fake a VP8 frame well enough to actually receive a callback from
147 // the software encoder. 152 // the software decoder.
148 TEST_F(VideoDecoderSoftwareFallbackWrapperTest, 153 TEST_F(VideoDecoderSoftwareFallbackWrapperTest,
149 ForwardsRegisterDecodeCompleteCallback) { 154 ForwardsRegisterDecodeCompleteCallback) {
150 class FakeDecodedImageCallback : public DecodedImageCallback { 155 class FakeDecodedImageCallback : public DecodedImageCallback {
151 int32_t Decoded(VideoFrame& decodedImage) override { return 0; } 156 int32_t Decoded(VideoFrame& decodedImage) override { return 0; }
152 int32_t Decoded( 157 int32_t Decoded(
153 webrtc::VideoFrame& decodedImage, int64_t decode_time_ms) override { 158 webrtc::VideoFrame& decodedImage, int64_t decode_time_ms) override {
154 RTC_NOTREACHED(); 159 RTC_NOTREACHED();
155 return -1; 160 return -1;
156 } 161 }
157 } callback, callback2; 162 } callback, callback2;
158 163
159 VideoCodec codec = {}; 164 VideoCodec codec = {};
160 fallback_wrapper_.InitDecode(&codec, 2); 165 fallback_wrapper_.InitDecode(&codec, 2);
161 fallback_wrapper_.RegisterDecodeCompleteCallback(&callback); 166 fallback_wrapper_.RegisterDecodeCompleteCallback(&callback);
162 EXPECT_EQ(&callback, fake_decoder_.decode_complete_callback_); 167 EXPECT_EQ(&callback, fake_decoder_.decode_complete_callback_);
163 168
164 fake_decoder_.decode_return_code_ = WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; 169 fake_decoder_.decode_return_code_ = WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
165 EncodedImage encoded_image; 170 EncodedImage encoded_image;
166 fallback_wrapper_.Decode(encoded_image, false, nullptr, nullptr, -1); 171 fallback_wrapper_.Decode(encoded_image, false, nullptr, nullptr, -1);
167 fallback_wrapper_.RegisterDecodeCompleteCallback(&callback2); 172 fallback_wrapper_.RegisterDecodeCompleteCallback(&callback2);
168 EXPECT_EQ(&callback2, fake_decoder_.decode_complete_callback_); 173 EXPECT_EQ(&callback2, fake_decoder_.decode_complete_callback_);
169 } 174 }
170 175
176 TEST_F(VideoDecoderSoftwareFallbackWrapperTest,
177 ReportsFallbackImplementationName) {
178 VideoCodec codec = {};
179 fallback_wrapper_.InitDecode(&codec, 2);
180
181 fake_decoder_.decode_return_code_ = WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
182 EncodedImage encoded_image;
183 fallback_wrapper_.Decode(encoded_image, false, nullptr, nullptr, -1);
184 // Hard coded expected value since libvpx is the software implementation name
185 // for VP8. Change accordingly if the underlying implementation does.
186 EXPECT_STREQ("libvpx (fallback from: fake-decoder)",
187 fallback_wrapper_.ImplementationName());
188 fallback_wrapper_.Release();
189 }
190
171 } // namespace webrtc 191 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_decoder.cc ('k') | webrtc/video/video_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698