| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // this object is waiting for a data request to complete, then this method | 71 // this object is waiting for a data request to complete, then this method |
| 72 // will wait for the data to arrive and then call the |callback| | 72 // will wait for the data to arrive and then call the |callback| |
| 73 // passed to Decode() with a status of MEDIA_CODEC_STOPPED. This ensures that | 73 // passed to Decode() with a status of MEDIA_CODEC_STOPPED. This ensures that |
| 74 // the |callback| passed to Decode() is always called and the status | 74 // the |callback| passed to Decode() is always called and the status |
| 75 // reflects whether data was actually decoded or the decode terminated early. | 75 // reflects whether data was actually decoded or the decode terminated early. |
| 76 void StopDecode(); | 76 void StopDecode(); |
| 77 | 77 |
| 78 // Flushes the decoder and abandons all the data that is being decoded. | 78 // Flushes the decoder and abandons all the data that is being decoded. |
| 79 virtual void Flush(); | 79 virtual void Flush(); |
| 80 | 80 |
| 81 // Enter prerolling state. The job must not currently be decoding. | 81 // Enters prerolling state. The job must not currently be decoding. |
| 82 void BeginPrerolling(base::TimeDelta preroll_timestamp); | 82 void BeginPrerolling(base::TimeDelta preroll_timestamp); |
| 83 | 83 |
| 84 // Releases all the decoder resources as the current tab is going background. | 84 // Releases all the decoder resources as the current tab is going background. |
| 85 virtual void ReleaseDecoderResources(); | 85 virtual void ReleaseDecoderResources(); |
| 86 | 86 |
| 87 // Sets the demuxer configs. Returns true if configs has changed, or false | 87 // Sets the demuxer configs. Returns true if configs has changed, or false |
| 88 // otherwise. | 88 // otherwise. |
| 89 bool SetDemuxerConfigs(const DemuxerConfigs& configs); | 89 bool SetDemuxerConfigs(const DemuxerConfigs& configs); |
| 90 | 90 |
| 91 // Returns whether the decoder has finished decoding all the data. | 91 // Returns whether the decoder has finished decoding all the data. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 // Implemented by the child class to create |media_codec_bridge_| for a | 223 // Implemented by the child class to create |media_codec_bridge_| for a |
| 224 // particular stream. Returns true if it is created, or false otherwise. | 224 // particular stream. Returns true if it is created, or false otherwise. |
| 225 virtual bool CreateMediaCodecBridgeInternal() = 0; | 225 virtual bool CreateMediaCodecBridgeInternal() = 0; |
| 226 | 226 |
| 227 // Returns true if the |configs| doesn't match the current demuxer configs | 227 // Returns true if the |configs| doesn't match the current demuxer configs |
| 228 // the decoder job has. | 228 // the decoder job has. |
| 229 virtual bool AreDemuxerConfigsChanged( | 229 virtual bool AreDemuxerConfigsChanged( |
| 230 const DemuxerConfigs& configs) const = 0; | 230 const DemuxerConfigs& configs) const = 0; |
| 231 | 231 |
| 232 // Update the demuxer configs. | 232 // Updates the demuxer configs. |
| 233 virtual void UpdateDemuxerConfigs(const DemuxerConfigs& configs) = 0; | 233 virtual void UpdateDemuxerConfigs(const DemuxerConfigs& configs) = 0; |
| 234 | 234 |
| 235 // Returns true if |media_codec_bridge_| needs to be reconfigured for the |
| 236 // new DemuxerConfigs, or false otherwise. |
| 237 virtual bool IsCodecReconfigureNeeded(const DemuxerConfigs& configs) const; |
| 238 |
| 235 // Return the index to |received_data_| that is not currently being decoded. | 239 // Return the index to |received_data_| that is not currently being decoded. |
| 236 size_t inactive_demuxer_data_index() const { | 240 size_t inactive_demuxer_data_index() const { |
| 237 return 1 - current_demuxer_data_index_; | 241 return 1 - current_demuxer_data_index_; |
| 238 } | 242 } |
| 239 | 243 |
| 240 // The UI message loop where callbacks should be dispatched. | 244 // The UI message loop where callbacks should be dispatched. |
| 241 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 245 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 242 | 246 |
| 243 // The task runner that decoder job runs on. | 247 // The task runner that decoder job runs on. |
| 244 scoped_refptr<base::SingleThreadTaskRunner> decoder_task_runner_; | 248 scoped_refptr<base::SingleThreadTaskRunner> decoder_task_runner_; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 // This access unit is passed to the decoder during config changes to drain | 339 // This access unit is passed to the decoder during config changes to drain |
| 336 // the decoder. | 340 // the decoder. |
| 337 AccessUnit eos_unit_; | 341 AccessUnit eos_unit_; |
| 338 | 342 |
| 339 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); | 343 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); |
| 340 }; | 344 }; |
| 341 | 345 |
| 342 } // namespace media | 346 } // namespace media |
| 343 | 347 |
| 344 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ | 348 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ |
| OLD | NEW |