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

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

Issue 1472943002: Refactor MediaCodecBridge to add support for NDK APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crazy linker issue 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
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_util.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/media_statistics.h"
13 #include "media/base/android/sdk_media_codec_bridge.h"
13 #include "media/base/android/test_data_factory.h" 14 #include "media/base/android/test_data_factory.h"
14 #include "media/base/android/test_statistics.h" 15 #include "media/base/android/test_statistics.h"
15 #include "media/base/timestamp_constants.h" 16 #include "media/base/timestamp_constants.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/gl/android/surface_texture.h" 18 #include "ui/gl/android/surface_texture.h"
18 19
19 namespace media { 20 namespace media {
20 21
21 // Helper macro to skip the test if MediaCodecBridge isn't available.
22 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \
23 do { \
24 if (!MediaCodecBridge::IsAvailable()) { \
25 VLOG(0) << "Could not run test - not supported on device."; \
26 return; \
27 } \
28 } while (0)
29
30 namespace { 22 namespace {
31 23
32 const base::TimeDelta kDefaultTimeout = base::TimeDelta::FromMilliseconds(200); 24 const base::TimeDelta kDefaultTimeout = base::TimeDelta::FromMilliseconds(200);
33 const base::TimeDelta kAudioFramePeriod = 25 const base::TimeDelta kAudioFramePeriod =
34 base::TimeDelta::FromSecondsD(1024.0 / 44100); // 1024 samples @ 44100 Hz 26 base::TimeDelta::FromSecondsD(1024.0 / 44100); // 1024 samples @ 44100 Hz
35 const base::TimeDelta kVideoFramePeriod = base::TimeDelta::FromMilliseconds(20); 27 const base::TimeDelta kVideoFramePeriod = base::TimeDelta::FromMilliseconds(20);
36 28
37 // A helper function to calculate the expected number of frames. 29 // A helper function to calculate the expected number of frames.
38 int GetFrameCount(base::TimeDelta duration, base::TimeDelta frame_period) { 30 int GetFrameCount(base::TimeDelta duration, base::TimeDelta frame_period) {
39 // A chunk has 4 access units. The last unit timestamp must exceed the 31 // A chunk has 4 access units. The last unit timestamp must exceed the
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 749
758 EXPECT_TRUE(decoder_->IsStopped()); 750 EXPECT_TRUE(decoder_->IsStopped());
759 EXPECT_TRUE(decoder_->IsCompleted()); 751 EXPECT_TRUE(decoder_->IsCompleted());
760 EXPECT_EQ(data_factory_->last_pts(), pts_stat_.max()); 752 EXPECT_EQ(data_factory_->last_pts(), pts_stat_.max());
761 753
762 // Check that the reported video size is the one from the in-stream configs. 754 // Check that the reported video size is the one from the in-stream configs.
763 EXPECT_EQ(data_factory_->GetConfigs().video_size, video_size_); 755 EXPECT_EQ(data_factory_->GetConfigs().video_size, video_size_);
764 } 756 }
765 757
766 } // namespace media 758 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_codec_decoder.cc ('k') | media/base/android/media_codec_player_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698