OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef MEDIA_BASE_PIPELINE_H_ |
6 #define MEDIA_BASE_PIPELINE_H_ | 6 #define MEDIA_BASE_PIPELINE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class MessageLoop; | 22 class MessageLoop; |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class MessageLoopProxy; | 25 class MessageLoopProxy; |
26 class TimeDelta; | 26 class TimeDelta; |
27 } | 27 } |
28 | 28 |
29 namespace media { | 29 namespace media { |
30 | 30 |
31 class AudioDecoder; | |
32 class Clock; | 31 class Clock; |
33 class FilterCollection; | 32 class FilterCollection; |
34 class MediaLog; | 33 class MediaLog; |
35 class VideoRenderer; | 34 class VideoRenderer; |
36 | 35 |
37 // Adapter for using asynchronous Pipeline methods in code that wants to run | 36 // Adapter for using asynchronous Pipeline methods in code that wants to run |
38 // synchronously. To use, construct an instance of this class and pass the | 37 // synchronously. To use, construct an instance of this class and pass the |
39 // |Callback()| to the Pipeline method requiring a callback. Then Wait() for | 38 // |Callback()| to the Pipeline method requiring a callback. Then Wait() for |
40 // the callback to get fired and call status() to see what the callback's | 39 // the callback to get fired and call status() to see what the callback's |
41 // argument was. This object is for one-time use; call |Callback()| exactly | 40 // argument was. This object is for one-time use; call |Callback()| exactly |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 friend class MediaLog; | 224 friend class MediaLog; |
226 | 225 |
227 // Only allow ourselves to be deleted by reference counting. | 226 // Only allow ourselves to be deleted by reference counting. |
228 friend class base::RefCountedThreadSafe<Pipeline>; | 227 friend class base::RefCountedThreadSafe<Pipeline>; |
229 virtual ~Pipeline(); | 228 virtual ~Pipeline(); |
230 | 229 |
231 // Pipeline states, as described above. | 230 // Pipeline states, as described above. |
232 enum State { | 231 enum State { |
233 kCreated, | 232 kCreated, |
234 kInitDemuxer, | 233 kInitDemuxer, |
235 kInitAudioDecoder, | |
236 kInitAudioRenderer, | 234 kInitAudioRenderer, |
237 kInitVideoRenderer, | 235 kInitVideoRenderer, |
238 kInitPrerolling, | 236 kInitPrerolling, |
239 kSeeking, | 237 kSeeking, |
240 kStarting, | 238 kStarting, |
241 kStarted, | 239 kStarted, |
242 kStopping, | 240 kStopping, |
243 kStopped, | 241 kStopped, |
244 }; | 242 }; |
245 | 243 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 void DoAudioRendererEnded(); | 314 void DoAudioRendererEnded(); |
317 void DoVideoRendererEnded(); | 315 void DoVideoRendererEnded(); |
318 void RunEndedCallbackIfNeeded(); | 316 void RunEndedCallbackIfNeeded(); |
319 | 317 |
320 // Carries out disabling the audio renderer. | 318 // Carries out disabling the audio renderer. |
321 void AudioDisabledTask(); | 319 void AudioDisabledTask(); |
322 | 320 |
323 // Kicks off initialization for each media object, executing |done_cb| with | 321 // Kicks off initialization for each media object, executing |done_cb| with |
324 // the result when completed. | 322 // the result when completed. |
325 void InitializeDemuxer(const PipelineStatusCB& done_cb); | 323 void InitializeDemuxer(const PipelineStatusCB& done_cb); |
326 void InitializeAudioDecoder(const PipelineStatusCB& done_cb); | |
327 void InitializeAudioRenderer(const PipelineStatusCB& done_cb); | 324 void InitializeAudioRenderer(const PipelineStatusCB& done_cb); |
328 void InitializeVideoRenderer(const PipelineStatusCB& done_cb); | 325 void InitializeVideoRenderer(const PipelineStatusCB& done_cb); |
329 | 326 |
330 // Kicks off destroying filters. Called by StopTask() and ErrorChangedTask(). | 327 // Kicks off destroying filters. Called by StopTask() and ErrorChangedTask(). |
331 // When we start to tear down the pipeline, we will consider two cases: | 328 // When we start to tear down the pipeline, we will consider two cases: |
332 // 1. when pipeline has not been initialized, we will transit to stopping | 329 // 1. when pipeline has not been initialized, we will transit to stopping |
333 // state first. | 330 // state first. |
334 // 2. when pipeline has been initialized, we will first transit to pausing | 331 // 2. when pipeline has been initialized, we will first transit to pausing |
335 // => flushing => stopping => stopped state. | 332 // => flushing => stopping => stopped state. |
336 // This will remove the race condition during stop between filters. | 333 // This will remove the race condition during stop between filters. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 BufferingStateCB buffering_state_cb_; | 450 BufferingStateCB buffering_state_cb_; |
454 | 451 |
455 // Renderer references used for setting the volume, playback rate, and | 452 // Renderer references used for setting the volume, playback rate, and |
456 // determining when playback has finished. | 453 // determining when playback has finished. |
457 scoped_refptr<AudioRenderer> audio_renderer_; | 454 scoped_refptr<AudioRenderer> audio_renderer_; |
458 scoped_refptr<VideoRenderer> video_renderer_; | 455 scoped_refptr<VideoRenderer> video_renderer_; |
459 | 456 |
460 // Demuxer reference used for setting the preload value. | 457 // Demuxer reference used for setting the preload value. |
461 scoped_refptr<Demuxer> demuxer_; | 458 scoped_refptr<Demuxer> demuxer_; |
462 | 459 |
463 // Audio decoder reference used during initialization. | |
464 // | |
465 // TODO(scherkus): Remove after renderers do initialization, see | |
466 // http://crbug.com/145635 | |
467 scoped_refptr<AudioDecoder> audio_decoder_; | |
468 | |
469 PipelineStatistics statistics_; | 460 PipelineStatistics statistics_; |
470 | 461 |
471 // Time of pipeline creation; is non-zero only until the pipeline first | 462 // Time of pipeline creation; is non-zero only until the pipeline first |
472 // reaches "kStarted", at which point it is used & zeroed out. | 463 // reaches "kStarted", at which point it is used & zeroed out. |
473 base::Time creation_time_; | 464 base::Time creation_time_; |
474 | 465 |
475 scoped_ptr<SerialRunner> pending_callbacks_; | 466 scoped_ptr<SerialRunner> pending_callbacks_; |
476 | 467 |
477 base::ThreadChecker thread_checker_; | 468 base::ThreadChecker thread_checker_; |
478 | 469 |
479 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 470 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
480 }; | 471 }; |
481 | 472 |
482 } // namespace media | 473 } // namespace media |
483 | 474 |
484 #endif // MEDIA_BASE_PIPELINE_H_ | 475 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |