| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_LOOP_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_LOOP_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_LOOP_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_LOOP_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/time/tick_clock.h" | 15 #include "base/time/tick_clock.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 18 #include "media/base/android/media_codec_bridge.h" | 18 #include "media/base/android/media_codec_bridge.h" |
| 19 #include "media/base/decode_status.h" | 19 #include "media/base/decode_status.h" |
| 20 #include "media/base/encryption_scheme.h" |
| 20 #include "media/base/media_export.h" | 21 #include "media/base/media_export.h" |
| 21 #include "media/base/subsample_entry.h" | 22 #include "media/base/subsample_entry.h" |
| 22 | 23 |
| 23 // MediaCodecLoop is based on Android's MediaCodec API. | 24 // MediaCodecLoop is based on Android's MediaCodec API. |
| 24 // The MediaCodec API is required to play encrypted (as in EME) content on | 25 // The MediaCodec API is required to play encrypted (as in EME) content on |
| 25 // Android. It is also a way to employ hardware-accelerated decoding. | 26 // Android. It is also a way to employ hardware-accelerated decoding. |
| 26 // One MediaCodecLoop instance owns a single MediaCodec(Bridge) instance, and | 27 // One MediaCodecLoop instance owns a single MediaCodec(Bridge) instance, and |
| 27 // drives it to perform decoding in conjunction with a MediaCodecLoop::Client. | 28 // drives it to perform decoding in conjunction with a MediaCodecLoop::Client. |
| 28 // The Client provides the input data and consumes the output data. A typical | 29 // The Client provides the input data and consumes the output data. A typical |
| 29 // example is AndroidVideoDecodeAccelerator. | 30 // example is AndroidVideoDecodeAccelerator. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 const uint8_t* memory = nullptr; | 122 const uint8_t* memory = nullptr; |
| 122 size_t length = 0; | 123 size_t length = 0; |
| 123 | 124 |
| 124 std::string key_id; | 125 std::string key_id; |
| 125 std::string iv; | 126 std::string iv; |
| 126 std::vector<SubsampleEntry> subsamples; | 127 std::vector<SubsampleEntry> subsamples; |
| 127 | 128 |
| 128 base::TimeDelta presentation_time; | 129 base::TimeDelta presentation_time; |
| 129 | 130 |
| 130 bool is_eos = false; | 131 bool is_eos = false; |
| 131 bool is_encrypted = false; | 132 EncryptionScheme encryption_scheme; |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 // Handy enum for "no buffer". | 135 // Handy enum for "no buffer". |
| 135 enum { kInvalidBufferIndex = -1 }; | 136 enum { kInvalidBufferIndex = -1 }; |
| 136 | 137 |
| 137 // Information about a MediaCodec output buffer. | 138 // Information about a MediaCodec output buffer. |
| 138 struct OutputBuffer { | 139 struct OutputBuffer { |
| 139 // The codec output buffers are referred to by this index. | 140 // The codec output buffers are referred to by this index. |
| 140 int index = kInvalidBufferIndex; | 141 int index = kInvalidBufferIndex; |
| 141 | 142 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 322 |
| 322 // NOTE: Weak pointers must be invalidated before all other member variables. | 323 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 323 base::WeakPtrFactory<MediaCodecLoop> weak_factory_; | 324 base::WeakPtrFactory<MediaCodecLoop> weak_factory_; |
| 324 | 325 |
| 325 DISALLOW_COPY_AND_ASSIGN(MediaCodecLoop); | 326 DISALLOW_COPY_AND_ASSIGN(MediaCodecLoop); |
| 326 }; | 327 }; |
| 327 | 328 |
| 328 } // namespace media | 329 } // namespace media |
| 329 | 330 |
| 330 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_LOOP_H_ | 331 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_LOOP_H_ |
| OLD | NEW |