OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "media/base/android/audio_decoder_job.h" | 11 #include "media/base/android/audio_decoder_job.h" |
| 12 #include "media/base/android/legacy_media_source_player.h" |
12 #include "media/base/android/media_codec_bridge.h" | 13 #include "media/base/android/media_codec_bridge.h" |
13 #include "media/base/android/media_drm_bridge.h" | 14 #include "media/base/android/media_drm_bridge.h" |
14 #include "media/base/android/media_player_manager.h" | 15 #include "media/base/android/media_player_manager.h" |
15 #include "media/base/android/media_source_player.h" | |
16 #include "media/base/android/media_url_interceptor.h" | 16 #include "media/base/android/media_url_interceptor.h" |
17 #include "media/base/android/video_decoder_job.h" | 17 #include "media/base/android/video_decoder_job.h" |
18 #include "media/base/bind_to_current_loop.h" | 18 #include "media/base/bind_to_current_loop.h" |
19 #include "media/base/decoder_buffer.h" | 19 #include "media/base/decoder_buffer.h" |
20 #include "media/base/test_data_util.h" | 20 #include "media/base/test_data_util.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
22 #include "ui/gl/android/surface_texture.h" | 22 #include "ui/gl/android/surface_texture.h" |
23 | 23 |
24 namespace media { | 24 namespace media { |
25 | 25 |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 } | 887 } |
888 | 888 |
889 bool IsDrainingDecoder(bool is_audio) { | 889 bool IsDrainingDecoder(bool is_audio) { |
890 return GetMediaDecoderJob(is_audio)->drain_decoder_; | 890 return GetMediaDecoderJob(is_audio)->drain_decoder_; |
891 } | 891 } |
892 | 892 |
893 protected: | 893 protected: |
894 base::MessageLoop message_loop_; | 894 base::MessageLoop message_loop_; |
895 MockMediaPlayerManager manager_; | 895 MockMediaPlayerManager manager_; |
896 MockDemuxerAndroid* demuxer_; // Owned by |player_|. | 896 MockDemuxerAndroid* demuxer_; // Owned by |player_|. |
897 MediaSourcePlayer player_; | 897 LegacyMediaSourcePlayer player_; |
898 | 898 |
899 // Track whether a possibly async decoder callback test hook has run. | 899 // Track whether a possibly async decoder callback test hook has run. |
900 bool decoder_callback_hook_executed_; | 900 bool decoder_callback_hook_executed_; |
901 | 901 |
902 // We need to keep the surface texture while the decoder is actively decoding. | 902 // We need to keep the surface texture while the decoder is actively decoding. |
903 // Otherwise, it may trigger unexpected crashes on some devices. To switch | 903 // Otherwise, it may trigger unexpected crashes on some devices. To switch |
904 // surfaces, tests need to create a new surface texture without releasing | 904 // surfaces, tests need to create a new surface texture without releasing |
905 // their previous one. In CreateNextTextureAndSetVideoSurface(), we toggle | 905 // their previous one. In CreateNextTextureAndSetVideoSurface(), we toggle |
906 // between two surface textures, only replacing the N-2 texture. Assumption is | 906 // between two surface textures, only replacing the N-2 texture. Assumption is |
907 // that no more than N-1 texture is in use by decoder when | 907 // that no more than N-1 texture is in use by decoder when |
(...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 // Wait for the metadata change. | 2507 // Wait for the metadata change. |
2508 while(manager_.num_metadata_changes() == 1) { | 2508 while(manager_.num_metadata_changes() == 1) { |
2509 player_.OnDemuxerDataAvailable(data); | 2509 player_.OnDemuxerDataAvailable(data); |
2510 WaitForVideoDecodeDone(); | 2510 WaitForVideoDecodeDone(); |
2511 } | 2511 } |
2512 EXPECT_EQ(2, manager_.num_metadata_changes()); | 2512 EXPECT_EQ(2, manager_.num_metadata_changes()); |
2513 WaitForVideoDecodeDone(); | 2513 WaitForVideoDecodeDone(); |
2514 } | 2514 } |
2515 | 2515 |
2516 } // namespace media | 2516 } // namespace media |
OLD | NEW |