| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_PIPELINE_IMPL_H_ | 5 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ |
| 6 #define MEDIA_BASE_PIPELINE_IMPL_H_ | 6 #define MEDIA_BASE_PIPELINE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 // Carries out notifying filters that we are seeking to a new timestamp. | 185 // Carries out notifying filters that we are seeking to a new timestamp. |
| 186 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb); | 186 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb); |
| 187 | 187 |
| 188 // Carries out setting the |cdm_context| in |renderer_|, and then fires | 188 // Carries out setting the |cdm_context| in |renderer_|, and then fires |
| 189 // |cdm_attached_cb| with the result. If |renderer_| is null, | 189 // |cdm_attached_cb| with the result. If |renderer_| is null, |
| 190 // |cdm_attached_cb| will be fired immediately with true, and |cdm_context| | 190 // |cdm_attached_cb| will be fired immediately with true, and |cdm_context| |
| 191 // will be set in |renderer_| later when |renderer_| is created. | 191 // will be set in |renderer_| later when |renderer_| is created. |
| 192 void SetCdmTask(CdmContext* cdm_context, | 192 void SetCdmTask(CdmContext* cdm_context, |
| 193 const CdmAttachedCB& cdm_attached_cb); | 193 const CdmAttachedCB& cdm_attached_cb); |
| 194 void OnCdmAttached(const CdmAttachedCB& cdm_attached_cb, |
| 195 CdmContext* cdm_context, |
| 196 bool success); |
| 194 | 197 |
| 195 // Callbacks executed when a renderer has ended. | 198 // Callbacks executed when a renderer has ended. |
| 196 void OnRendererEnded(); | 199 void OnRendererEnded(); |
| 197 void OnTextRendererEnded(); | 200 void OnTextRendererEnded(); |
| 198 void RunEndedCallbackIfNeeded(); | 201 void RunEndedCallbackIfNeeded(); |
| 199 | 202 |
| 200 scoped_ptr<TextRenderer> CreateTextRenderer(); | 203 scoped_ptr<TextRenderer> CreateTextRenderer(); |
| 201 | 204 |
| 202 // Carries out adding a new text stream to the text renderer. | 205 // Carries out adding a new text stream to the text renderer. |
| 203 void AddTextStreamTask(DemuxerStream* text_stream, | 206 void AddTextStreamTask(DemuxerStream* text_stream, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 312 |
| 310 // Holds the initialized renderers. Used for setting the volume, | 313 // Holds the initialized renderers. Used for setting the volume, |
| 311 // playback rate, and determining when playback has finished. | 314 // playback rate, and determining when playback has finished. |
| 312 scoped_ptr<Renderer> renderer_; | 315 scoped_ptr<Renderer> renderer_; |
| 313 scoped_ptr<TextRenderer> text_renderer_; | 316 scoped_ptr<TextRenderer> text_renderer_; |
| 314 | 317 |
| 315 PipelineStatistics statistics_; | 318 PipelineStatistics statistics_; |
| 316 | 319 |
| 317 scoped_ptr<SerialRunner> pending_callbacks_; | 320 scoped_ptr<SerialRunner> pending_callbacks_; |
| 318 | 321 |
| 319 // CdmContext to be used to decrypt (and decode) encrypted stream in this | 322 // The CdmContext to be used to decrypt (and decode) encrypted stream in this |
| 320 // pipeline. Non-null only when SetCdm() is called and the pipeline has not | 323 // pipeline. It is set when SetCdm() succeeds on the renderer (or when |
| 321 // been started. Then during Start(), this value will be set on |renderer_|. | 324 // SetCdm() is called before Start()), after which it is guaranteed to outlive |
| 322 CdmContext* pending_cdm_context_; | 325 // this pipeline. The saved value will be used to configure new renderers, |
| 326 // when starting or resuming. |
| 327 CdmContext* cdm_context_; |
| 323 | 328 |
| 324 base::ThreadChecker thread_checker_; | 329 base::ThreadChecker thread_checker_; |
| 325 | 330 |
| 326 // NOTE: Weak pointers must be invalidated before all other member variables. | 331 // A weak pointer that can be safely copied on the media thread. |
| 332 base::WeakPtr<PipelineImpl> weak_this_; |
| 333 |
| 334 // Weak pointers must be created on the main thread, and must be dereferenced |
| 335 // on the media thread. |
| 336 // |
| 337 // Declared last so that weak pointers will be invalidated before all other |
| 338 // member variables. |
| 327 base::WeakPtrFactory<PipelineImpl> weak_factory_; | 339 base::WeakPtrFactory<PipelineImpl> weak_factory_; |
| 328 | 340 |
| 329 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); | 341 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); |
| 330 }; | 342 }; |
| 331 | 343 |
| 332 } // namespace media | 344 } // namespace media |
| 333 | 345 |
| 334 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ | 346 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ |
| OLD | NEW |