Chromium Code Reviews| Index: media/base/android/media_codec_loop.h |
| diff --git a/media/base/android/media_codec_loop.h b/media/base/android/media_codec_loop.h |
| index 8d257dea09885f6b3e58bf3d8e3ab78a83c4e8e5..96f4edeefd2238799e453a60fcf46d047af2e83f 100644 |
| --- a/media/base/android/media_codec_loop.h |
| +++ b/media/base/android/media_codec_loop.h |
| @@ -12,11 +12,12 @@ |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "base/time/tick_clock.h" |
| #include "base/time/time.h" |
| #include "base/timer/timer.h" |
| #include "media/base/android/media_codec_bridge.h" |
| -#include "media/base/audio_decoder.h" |
| -#include "media/base/audio_decoder_config.h" |
| +#include "media/base/decode_status.h" |
| +#include "media/base/decrypt_config.h" |
| #include "media/base/media_export.h" |
| // MediaCodecLoop is based on Android's MediaCodec API. |
| @@ -197,9 +198,20 @@ class MEDIA_EXPORT MediaCodecLoop { |
| // We will take ownership of |media_codec|. We will not destroy it until |
| // we are destructed. |media_codec| may not be null. |
| - MediaCodecLoop(Client* client, std::unique_ptr<MediaCodecBridge> media_codec); |
| + // |sdk_level| is temporary. It is used only to decouple MediaCodecLoop from |
| + // BuildInfo, until we get BuildInfo into a mockable state. |
| + MediaCodecLoop(int sdk_level, |
| + Client* client, |
| + std::unique_ptr<MediaCodecBridge> media_codec, |
| + scoped_refptr<base::SingleThreadTaskRunner> = |
| + scoped_refptr<base::SingleThreadTaskRunner>()); |
| ~MediaCodecLoop(); |
| + // Optionally set the tick clock used for testing. It is our caller's |
| + // responsibility to maintain ownership of this, since |
| + // FakeSingleThreadTaskRunner maintains a raw ptr to it also. |
| + void SetTestTickClock(base::TickClock* test_tick_clock); |
| + |
| // Does the MediaCodec processing cycle: enqueues an input buffer, then |
| // dequeues output buffers. This should be called by the client when more |
| // work becomes available, such as when new input data arrives. If codec |
| @@ -271,13 +283,12 @@ class MEDIA_EXPORT MediaCodecLoop { |
| // Helper method to change the state. |
| void SetState(State new_state); |
| + // Helper method to tell us if MediaCodecBridge::Flush() doesn't work. |
| + bool DoesCodecFlushRequireDestruction() const; |
| + |
| // A helper function for logging. |
| static const char* AsString(State state); |
| - // Used to post tasks. This class is single threaded and every method should |
| - // run on this task runner. |
| - scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| - |
| State state_; |
| // The client that we notify about MediaCodec events. |
| @@ -301,6 +312,13 @@ class MEDIA_EXPORT MediaCodecLoop { |
| // to us by the client. |memory| has been cleared, since the codec has it. |
| InputData pending_input_buf_data_; |
| + // Optional clock for use during testing. It may be null. We do not maintain |
| + // ownership of it. |
| + base::TickClock* test_tick_clock_ = nullptr; |
|
DaleCurtis
2016/08/01 18:23:17
If you're going to use in header initialization do
|
| + |
| + // BuildInfo::sdk_int(), eventually. |
| + const int sdk_int_; |
| + |
| // NOTE: Weak pointers must be invalidated before all other member variables. |
| base::WeakPtrFactory<MediaCodecLoop> weak_factory_; |