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 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ |
7 | 7 |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 // Returns true if the decoder is in kPrerolling state. | 237 // Returns true if the decoder is in kPrerolling state. |
238 bool IsPrerollingForTests() const; | 238 bool IsPrerollingForTests() const; |
239 | 239 |
240 // Drains decoder and reconfigures for each |kConfigChanged|. | 240 // Drains decoder and reconfigures for each |kConfigChanged|. |
241 void SetAlwaysReconfigureForTests(); | 241 void SetAlwaysReconfigureForTests(); |
242 | 242 |
243 // Sets the notification to be called when MediaCodec is created. | 243 // Sets the notification to be called when MediaCodec is created. |
244 void SetCodecCreatedCallbackForTests(base::Closure cb); | 244 void SetCodecCreatedCallbackForTests(base::Closure cb); |
245 | 245 |
| 246 // Turn on and off extra logging with elevated log level. |
| 247 void SetVerboseForTests(bool value); |
| 248 |
246 protected: | 249 protected: |
247 enum RenderMode { | 250 enum RenderMode { |
248 kRenderSkip = 0, | 251 kRenderSkip = 0, |
249 kRenderAfterPreroll, | 252 kRenderAfterPreroll, |
250 kRenderNow, | 253 kRenderNow, |
251 }; | 254 }; |
252 | 255 |
253 // Returns true if the new DemuxerConfigs requires MediaCodec | 256 // Returns true if the new DemuxerConfigs requires MediaCodec |
254 // reconfiguration. | 257 // reconfiguration. |
255 virtual bool IsCodecReconfigureNeeded(const DemuxerConfigs& next) const = 0; | 258 virtual bool IsCodecReconfigureNeeded(const DemuxerConfigs& next) const = 0; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // Flag forces reconfiguration even if |media_codec_bridge_| exists. Currently | 322 // Flag forces reconfiguration even if |media_codec_bridge_| exists. Currently |
320 // is set by video decoder when the video surface changes. | 323 // is set by video decoder when the video surface changes. |
321 bool needs_reconfigure_; | 324 bool needs_reconfigure_; |
322 | 325 |
323 // Flag forces to drain decoder in the process of dynamic reconfiguration. | 326 // Flag forces to drain decoder in the process of dynamic reconfiguration. |
324 bool drain_decoder_; | 327 bool drain_decoder_; |
325 | 328 |
326 // For tests only. Forces to always reconfigure for |kConfigChanged| unit. | 329 // For tests only. Forces to always reconfigure for |kConfigChanged| unit. |
327 bool always_reconfigure_for_tests_; | 330 bool always_reconfigure_for_tests_; |
328 | 331 |
| 332 // For tests only. Enables more logging output. |
| 333 bool verbose_; |
| 334 |
329 // For tests only. Callback to be callned when MediaCodec is created. | 335 // For tests only. Callback to be callned when MediaCodec is created. |
330 base::Closure codec_created_for_tests_cb_; | 336 base::Closure codec_created_for_tests_cb_; |
331 | 337 |
332 private: | 338 private: |
333 enum DecoderState { | 339 enum DecoderState { |
334 kStopped = 0, | 340 kStopped = 0, |
335 kPrefetching, | 341 kPrefetching, |
336 kPrefetched, | 342 kPrefetched, |
337 kPrerolling, | 343 kPrerolling, |
338 kPrerolled, | 344 kPrerolled, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 446 |
441 // NOTE: Weak pointers must be invalidated before all other member variables. | 447 // NOTE: Weak pointers must be invalidated before all other member variables. |
442 base::WeakPtrFactory<MediaCodecDecoder> weak_factory_; | 448 base::WeakPtrFactory<MediaCodecDecoder> weak_factory_; |
443 | 449 |
444 DISALLOW_COPY_AND_ASSIGN(MediaCodecDecoder); | 450 DISALLOW_COPY_AND_ASSIGN(MediaCodecDecoder); |
445 }; | 451 }; |
446 | 452 |
447 } // namespace media | 453 } // namespace media |
448 | 454 |
449 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ | 455 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_DECODER_H_ |
OLD | NEW |