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 #ifndef MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 // Called by MediaSourcePlayer when more data for this object has arrived. | 47 // Called by MediaSourcePlayer when more data for this object has arrived. |
48 void OnDataReceived(const DemuxerData& data); | 48 void OnDataReceived(const DemuxerData& data); |
49 | 49 |
50 // Prefetch so we know the decoder job has data when we call Decode(). | 50 // Prefetch so we know the decoder job has data when we call Decode(). |
51 // |prefetch_cb| - Run when prefetching has completed. | 51 // |prefetch_cb| - Run when prefetching has completed. |
52 void Prefetch(const base::Closure& prefetch_cb); | 52 void Prefetch(const base::Closure& prefetch_cb); |
53 | 53 |
54 // Called by MediaSourcePlayer to decode some data. | 54 // Called by MediaSourcePlayer to decode some data. |
55 // |callback| - Run when decode operation has completed. | 55 // |callback| - Run when decode operation has completed. |
56 // | 56 // |
57 // Returns true if the next decode was started and |callback| will be | 57 // Returns the pointer to a DemuxerConfig if a config change is detected, or |
58 // called when the decode operation is complete. | 58 // Null otherwise. If the return value is NULL, decode was started and |
wolenetz
2014/05/05 22:06:55
nit: s/Null/NULL
qinmin
2014/05/06 18:05:26
Done.
| |
59 // |callback| will be called when the decode operation is complete. | |
59 // Returns false if a config change is needed. |callback| is ignored | 60 // Returns false if a config change is needed. |callback| is ignored |
wolenetz
2014/05/05 22:06:55
nit: s/Returns false if a config change is needed.
qinmin
2014/05/06 18:05:26
Done.
| |
60 // and will not be called. | 61 // and will not be called. |
61 bool Decode(base::TimeTicks start_time_ticks, | 62 DemuxerConfigs* Decode(base::TimeTicks start_time_ticks, |
62 base::TimeDelta start_presentation_timestamp, | 63 base::TimeDelta start_presentation_timestamp, |
63 const DecoderCallback& callback); | 64 const DecoderCallback& callback); |
64 | 65 |
65 // Called to stop the last Decode() early. | 66 // Called to stop the last Decode() early. |
66 // If the decoder is in the process of decoding the next frame, then | 67 // If the decoder is in the process of decoding the next frame, then |
67 // this method will just allow the decode to complete as normal. If | 68 // this method will just allow the decode to complete as normal. If |
68 // this object is waiting for a data request to complete, then this method | 69 // this object is waiting for a data request to complete, then this method |
69 // will wait for the data to arrive and then call the |callback| | 70 // will wait for the data to arrive and then call the |callback| |
70 // passed to Decode() with a status of MEDIA_CODEC_STOPPED. This ensures that | 71 // passed to Decode() with a status of MEDIA_CODEC_STOPPED. This ensures that |
71 // the |callback| passed to Decode() is always called and the status | 72 // the |callback| passed to Decode() is always called and the status |
72 // reflects whether data was actually decoded or the decode terminated early. | 73 // reflects whether data was actually decoded or the decode terminated early. |
73 void StopDecode(); | 74 void StopDecode(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 // Called on the UI thread to indicate that one decode cycle has completed. | 141 // Called on the UI thread to indicate that one decode cycle has completed. |
141 // Completes any pending job destruction or any pending decode stop. If | 142 // Completes any pending job destruction or any pending decode stop. If |
142 // destruction was not pending, passes its arguments to |decode_cb_|. | 143 // destruction was not pending, passes its arguments to |decode_cb_|. |
143 void OnDecodeCompleted(MediaCodecStatus status, | 144 void OnDecodeCompleted(MediaCodecStatus status, |
144 base::TimeDelta current_presentation_timestamp, | 145 base::TimeDelta current_presentation_timestamp, |
145 base::TimeDelta max_presentation_timestamp); | 146 base::TimeDelta max_presentation_timestamp); |
146 | 147 |
147 // Helper function to get the current access unit that is being decoded. | 148 // Helper function to get the current access unit that is being decoded. |
148 const AccessUnit& CurrentAccessUnit() const; | 149 const AccessUnit& CurrentAccessUnit() const; |
149 | 150 |
151 // Helper function to get the current data chunk index that is being decoded. | |
152 size_t CurrentReceivedDataChunkIndex() const; | |
153 | |
150 // Check whether a chunk has no remaining access units to decode. If | 154 // Check whether a chunk has no remaining access units to decode. If |
151 // |is_active_chunk| is true, this function returns whether decoder has | 155 // |is_active_chunk| is true, this function returns whether decoder has |
152 // consumed all data in |received_data_[current_demuxer_data_index_]|. | 156 // consumed all data in |received_data_[current_demuxer_data_index_]|. |
153 // Otherwise, it returns whether decoder has consumed all data in the inactive | 157 // Otherwise, it returns whether decoder has consumed all data in the inactive |
154 // chunk. | 158 // chunk. |
155 bool NoAccessUnitsRemainingInChunk(bool is_active_chunk) const; | 159 bool NoAccessUnitsRemainingInChunk(bool is_active_chunk) const; |
156 | 160 |
157 // Clearn all the received data. | 161 // Clearn all the received data. |
158 void ClearData(); | 162 void ClearData(); |
159 | 163 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 // the decoder thread. | 255 // the decoder thread. |
252 // NOTE: Weak pointers must be invalidated before all other member variables. | 256 // NOTE: Weak pointers must be invalidated before all other member variables. |
253 base::WeakPtrFactory<MediaDecoderJob> weak_factory_; | 257 base::WeakPtrFactory<MediaDecoderJob> weak_factory_; |
254 | 258 |
255 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); | 259 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); |
256 }; | 260 }; |
257 | 261 |
258 } // namespace media | 262 } // namespace media |
259 | 263 |
260 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 264 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
OLD | NEW |