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

Side by Side Diff: media/base/android/media_codec_player_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: addressing comments 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "media/base/android/demuxer_android.h" 10 #include "media/base/android/demuxer_android.h"
11 #include "media/base/android/media_codec_bridge.h"
12 #include "media/base/android/media_codec_player.h" 11 #include "media/base/android/media_codec_player.h"
12 #include "media/base/android/media_codec_util.h"
13 #include "media/base/android/media_player_manager.h" 13 #include "media/base/android/media_player_manager.h"
14 #include "media/base/android/media_task_runner.h" 14 #include "media/base/android/media_task_runner.h"
15 #include "media/base/android/sdk_media_codec_bridge.h"
15 #include "media/base/android/test_data_factory.h" 16 #include "media/base/android/test_data_factory.h"
16 #include "media/base/android/test_statistics.h" 17 #include "media/base/android/test_statistics.h"
17 #include "media/base/timestamp_constants.h" 18 #include "media/base/timestamp_constants.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "ui/gl/android/surface_texture.h" 20 #include "ui/gl/android/surface_texture.h"
20 21
21 namespace media { 22 namespace media {
22 23
23 // Helper macro to skip the test if MediaCodecBridge isn't available.
24 #define SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE() \
25 do { \
26 if (!MediaCodecBridge::IsAvailable()) { \
27 VLOG(0) << "Could not run test - not supported on device."; \
28 return; \
29 } \
30 } while (0)
31
32 #define RUN_ON_MEDIA_THREAD(CLASS, METHOD, ...) \ 24 #define RUN_ON_MEDIA_THREAD(CLASS, METHOD, ...) \
33 do { \ 25 do { \
34 if (!GetMediaTaskRunner()->BelongsToCurrentThread()) { \ 26 if (!GetMediaTaskRunner()->BelongsToCurrentThread()) { \
35 GetMediaTaskRunner()->PostTask( \ 27 GetMediaTaskRunner()->PostTask( \
36 FROM_HERE, \ 28 FROM_HERE, \
37 base::Bind(&CLASS::METHOD, base::Unretained(this), ##__VA_ARGS__)); \ 29 base::Bind(&CLASS::METHOD, base::Unretained(this), ##__VA_ARGS__)); \
38 return; \ 30 return; \
39 } \ 31 } \
40 } while (0) 32 } while (0)
41 33
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2274 // TODO(timav): maybe we should not call the testing callback for 2266 // TODO(timav): maybe we should not call the testing callback for
2275 // kRenderAfterPreroll for video (for audio we already do not call). 2267 // kRenderAfterPreroll for video (for audio we already do not call).
2276 // EXPECT_TRUE(AlmostEqual(manager_.FirstFrameTime(DemuxerStream::AUDIO), 2268 // EXPECT_TRUE(AlmostEqual(manager_.FirstFrameTime(DemuxerStream::AUDIO),
2277 // manager_.FirstFrameTime(DemuxerStream::VIDEO), 50)); 2269 // manager_.FirstFrameTime(DemuxerStream::VIDEO), 50));
2278 2270
2279 // The playback should start at |seek_position| 2271 // The playback should start at |seek_position|
2280 EXPECT_TRUE(AlmostEqual(seek_position, manager_.pts_stat_.min(), 25)); 2272 EXPECT_TRUE(AlmostEqual(seek_position, manager_.pts_stat_.min(), 25));
2281 } 2273 }
2282 2274
2283 } // namespace media 2275 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698