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

Side by Side Diff: media/base/android/media_codec_decoder_unittest.cc

Issue 1367403003: Added UMA metrics for MediaSourcePlayer and MediaCodecPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtplayer-drm
Patch Set: Attempt to fix clang compilation Created 5 years, 2 months 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 | « media/base/android/media_codec_decoder.cc ('k') | media/base/android/media_codec_player.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "base/timer/timer.h" 8 #include "base/timer/timer.h"
9 #include "media/base/android/media_codec_audio_decoder.h" 9 #include "media/base/android/media_codec_audio_decoder.h"
10 #include "media/base/android/media_codec_bridge.h" 10 #include "media/base/android/media_codec_bridge.h"
11 #include "media/base/android/media_codec_video_decoder.h" 11 #include "media/base/android/media_codec_video_decoder.h"
12 #include "media/base/android/media_statistics.h"
12 #include "media/base/android/test_data_factory.h" 13 #include "media/base/android/test_data_factory.h"
13 #include "media/base/android/test_statistics.h" 14 #include "media/base/android/test_statistics.h"
14 #include "media/base/timestamp_constants.h" 15 #include "media/base/timestamp_constants.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "ui/gl/android/surface_texture.h" 17 #include "ui/gl/android/surface_texture.h"
17 18
18 namespace media { 19 namespace media {
19 20
20 // Helper macro to skip the test if MediaCodecBridge isn't available. 21 // Helper macro to skip the test if MediaCodecBridge isn't available.
21 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \ 22 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 221
221 base::MessageLoop message_loop_; 222 base::MessageLoop message_loop_;
222 bool is_timeout_expired_; 223 bool is_timeout_expired_;
223 224
224 bool is_prefetched_; 225 bool is_prefetched_;
225 bool is_stopped_; 226 bool is_stopped_;
226 bool is_starved_; 227 bool is_starved_;
227 base::TimeDelta stop_request_time_; 228 base::TimeDelta stop_request_time_;
228 229
229 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 230 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
231 FrameStatistics frame_statistics_;
230 DataAvailableCallback data_available_cb_; 232 DataAvailableCallback data_available_cb_;
231 scoped_refptr<gfx::SurfaceTexture> surface_texture_; 233 scoped_refptr<gfx::SurfaceTexture> surface_texture_;
232 234
233 DISALLOW_COPY_AND_ASSIGN(MediaCodecDecoderTest); 235 DISALLOW_COPY_AND_ASSIGN(MediaCodecDecoderTest);
234 }; 236 };
235 237
236 MediaCodecDecoderTest::MediaCodecDecoderTest() 238 MediaCodecDecoderTest::MediaCodecDecoderTest()
237 : is_timeout_expired_(false), 239 : is_timeout_expired_(false),
238 is_prefetched_(false), 240 is_prefetched_(false),
239 is_stopped_(false), 241 is_stopped_(false),
(...skipping 23 matching lines...) Expand all
263 } 265 }
264 message_loop_.RunUntilIdle(); 266 message_loop_.RunUntilIdle();
265 } while (!is_timeout_expired()); 267 } while (!is_timeout_expired());
266 268
267 DCHECK(!timer.IsRunning()); 269 DCHECK(!timer.IsRunning());
268 return false; 270 return false;
269 } 271 }
270 272
271 void MediaCodecDecoderTest::CreateAudioDecoder() { 273 void MediaCodecDecoderTest::CreateAudioDecoder() {
272 decoder_ = scoped_ptr<MediaCodecDecoder>(new MediaCodecAudioDecoder( 274 decoder_ = scoped_ptr<MediaCodecDecoder>(new MediaCodecAudioDecoder(
273 task_runner_, base::Bind(&MediaCodecDecoderTest::OnDataRequested, 275 task_runner_, &frame_statistics_,
274 base::Unretained(this)), 276 base::Bind(&MediaCodecDecoderTest::OnDataRequested,
277 base::Unretained(this)),
275 base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)), 278 base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)),
276 base::Bind(&MediaCodecDecoderTest::OnDecoderDrained, 279 base::Bind(&MediaCodecDecoderTest::OnDecoderDrained,
277 base::Unretained(this)), 280 base::Unretained(this)),
278 base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)), 281 base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)),
279 base::Bind(&MediaCodecDecoderTest::OnKeyRequired, base::Unretained(this)), 282 base::Bind(&MediaCodecDecoderTest::OnKeyRequired, base::Unretained(this)),
280 base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)), 283 base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)),
281 base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime, 284 base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime,
282 base::Unretained(this)))); 285 base::Unretained(this))));
283 286
284 data_available_cb_ = base::Bind(&MediaCodecDecoder::OnDemuxerDataAvailable, 287 data_available_cb_ = base::Bind(&MediaCodecDecoder::OnDemuxerDataAvailable,
285 base::Unretained(decoder_.get())); 288 base::Unretained(decoder_.get()));
286 } 289 }
287 290
288 void MediaCodecDecoderTest::CreateVideoDecoder() { 291 void MediaCodecDecoderTest::CreateVideoDecoder() {
289 decoder_ = scoped_ptr<MediaCodecDecoder>(new MediaCodecVideoDecoder( 292 decoder_ = scoped_ptr<MediaCodecDecoder>(new MediaCodecVideoDecoder(
290 task_runner_, base::Bind(&MediaCodecDecoderTest::OnDataRequested, 293 task_runner_, &frame_statistics_,
291 base::Unretained(this)), 294 base::Bind(&MediaCodecDecoderTest::OnDataRequested,
295 base::Unretained(this)),
292 base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)), 296 base::Bind(&MediaCodecDecoderTest::OnStarvation, base::Unretained(this)),
293 base::Bind(&MediaCodecDecoderTest::OnDecoderDrained, 297 base::Bind(&MediaCodecDecoderTest::OnDecoderDrained,
294 base::Unretained(this)), 298 base::Unretained(this)),
295 base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)), 299 base::Bind(&MediaCodecDecoderTest::OnStopDone, base::Unretained(this)),
296 base::Bind(&MediaCodecDecoderTest::OnKeyRequired, base::Unretained(this)), 300 base::Bind(&MediaCodecDecoderTest::OnKeyRequired, base::Unretained(this)),
297 base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)), 301 base::Bind(&MediaCodecDecoderTest::OnError, base::Unretained(this)),
298 base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime, 302 base::Bind(&MediaCodecDecoderTest::OnUpdateCurrentTime,
299 base::Unretained(this)), 303 base::Unretained(this)),
300 base::Bind(&MediaCodecDecoderTest::OnVideoSizeChanged, 304 base::Bind(&MediaCodecDecoderTest::OnVideoSizeChanged,
301 base::Unretained(this)), 305 base::Unretained(this)),
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 759
756 EXPECT_TRUE(decoder_->IsStopped()); 760 EXPECT_TRUE(decoder_->IsStopped());
757 EXPECT_TRUE(decoder_->IsCompleted()); 761 EXPECT_TRUE(decoder_->IsCompleted());
758 EXPECT_EQ(data_factory_->last_pts(), pts_stat_.max()); 762 EXPECT_EQ(data_factory_->last_pts(), pts_stat_.max());
759 763
760 // Check that the reported video size is the one from the in-stream configs. 764 // Check that the reported video size is the one from the in-stream configs.
761 EXPECT_EQ(data_factory_->GetConfigs().video_size, video_size_); 765 EXPECT_EQ(data_factory_->GetConfigs().video_size, video_size_);
762 } 766 }
763 767
764 } // namespace media 768 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_codec_decoder.cc ('k') | media/base/android/media_codec_player.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698