| OLD | NEW |
| 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" |
| 11 #include "media/base/android/media_codec_player.h" | 12 #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" | |
| 16 #include "media/base/android/test_data_factory.h" | 15 #include "media/base/android/test_data_factory.h" |
| 17 #include "media/base/android/test_statistics.h" | 16 #include "media/base/android/test_statistics.h" |
| 18 #include "media/base/timestamp_constants.h" | 17 #include "media/base/timestamp_constants.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "ui/gl/android/surface_texture.h" | 19 #include "ui/gl/android/surface_texture.h" |
| 21 | 20 |
| 22 namespace media { | 21 namespace media { |
| 23 | 22 |
| 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 |
| 24 #define RUN_ON_MEDIA_THREAD(CLASS, METHOD, ...) \ | 32 #define RUN_ON_MEDIA_THREAD(CLASS, METHOD, ...) \ |
| 25 do { \ | 33 do { \ |
| 26 if (!GetMediaTaskRunner()->BelongsToCurrentThread()) { \ | 34 if (!GetMediaTaskRunner()->BelongsToCurrentThread()) { \ |
| 27 GetMediaTaskRunner()->PostTask( \ | 35 GetMediaTaskRunner()->PostTask( \ |
| 28 FROM_HERE, \ | 36 FROM_HERE, \ |
| 29 base::Bind(&CLASS::METHOD, base::Unretained(this), ##__VA_ARGS__)); \ | 37 base::Bind(&CLASS::METHOD, base::Unretained(this), ##__VA_ARGS__)); \ |
| 30 return; \ | 38 return; \ |
| 31 } \ | 39 } \ |
| 32 } while (0) | 40 } while (0) |
| 33 | 41 |
| (...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 // TODO(timav): maybe we should not call the testing callback for | 2274 // TODO(timav): maybe we should not call the testing callback for |
| 2267 // kRenderAfterPreroll for video (for audio we already do not call). | 2275 // kRenderAfterPreroll for video (for audio we already do not call). |
| 2268 // EXPECT_TRUE(AlmostEqual(manager_.FirstFrameTime(DemuxerStream::AUDIO), | 2276 // EXPECT_TRUE(AlmostEqual(manager_.FirstFrameTime(DemuxerStream::AUDIO), |
| 2269 // manager_.FirstFrameTime(DemuxerStream::VIDEO), 50)); | 2277 // manager_.FirstFrameTime(DemuxerStream::VIDEO), 50)); |
| 2270 | 2278 |
| 2271 // The playback should start at |seek_position| | 2279 // The playback should start at |seek_position| |
| 2272 EXPECT_TRUE(AlmostEqual(seek_position, manager_.pts_stat_.min(), 25)); | 2280 EXPECT_TRUE(AlmostEqual(seek_position, manager_.pts_stat_.min(), 25)); |
| 2273 } | 2281 } |
| 2274 | 2282 |
| 2275 } // namespace media | 2283 } // namespace media |
| OLD | NEW |