Chromium Code Reviews| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 // | Start() ^ | 71 // | Start() ^ |
| 72 // V SetError() | | 72 // V SetError() | |
| 73 // [ InitXXX (for each filter) ] -------->[ Stopping (for each filter) ] | 73 // [ InitXXX (for each filter) ] -------->[ Stopping (for each filter) ] |
| 74 // | ^ | 74 // | ^ |
| 75 // V | if Stop | 75 // V | if Stop |
| 76 // [ Seeking (for each filter) ] <--------[ Flushing (for each filter) ] | 76 // [ Seeking (for each filter) ] <--------[ Flushing (for each filter) ] |
| 77 // | if Seek ^ | 77 // | if Seek ^ |
| 78 // V | | 78 // V | |
| 79 // [ Starting (for each filter) ] | | 79 // [ Starting (for each filter) ] | |
| 80 // | | | 80 // | | |
| 81 // V Seek()/Stop() | | 81 // V Seek()/Stop() | |
|
Ami GONE FROM CHROMIUM
2012/08/08 21:48:26
why no mention of the On*Ended() callbacks?
scherkus (not reviewing)
2012/08/08 22:28:34
Not sure if they'd be helpful / how I could fit th
| |
| 82 // [ Started ] -------------------------> [ Pausing (for each filter) ] | 82 // [ Started ] -------------------------> [ Pausing (for each filter) ] |
| 83 // | ^ | |
| 84 // | OnRendererEnded() Seek()/Stop() | | |
| 85 // `-------------> [ Ended ] ---------------------' | |
| 86 // ^ SetError() | 83 // ^ SetError() |
| 87 // | | 84 // | |
| 88 // [ Any State Other Than InitXXX ] | 85 // [ Any State Other Than InitXXX ] |
| 89 | 86 |
| 90 // | 87 // |
| 91 // Initialization is a series of state transitions from "Created" through each | 88 // Initialization is a series of state transitions from "Created" through each |
| 92 // filter initialization state. When all filter initialization states have | 89 // filter initialization state. When all filter initialization states have |
| 93 // completed, we are implicitly in a "Paused" state. At that point we simulate | 90 // completed, we are implicitly in a "Paused" state. At that point we simulate |
| 94 // a Seek() to the beginning of the media to give filters a chance to preroll. | 91 // a Seek() to the beginning of the media to give filters a chance to preroll. |
| 95 // From then on the normal Seek() transitions are carried out and we start | 92 // From then on the normal Seek() transitions are carried out and we start |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 kInitDemuxer, | 236 kInitDemuxer, |
| 240 kInitAudioDecoder, | 237 kInitAudioDecoder, |
| 241 kInitAudioRenderer, | 238 kInitAudioRenderer, |
| 242 kInitVideoDecoder, | 239 kInitVideoDecoder, |
| 243 kInitVideoRenderer, | 240 kInitVideoRenderer, |
| 244 kPausing, | 241 kPausing, |
| 245 kSeeking, | 242 kSeeking, |
| 246 kFlushing, | 243 kFlushing, |
| 247 kStarting, | 244 kStarting, |
| 248 kStarted, | 245 kStarted, |
| 249 kEnded, | |
| 250 kStopping, | 246 kStopping, |
| 251 kStopped, | 247 kStopped, |
| 252 kError, | 248 kError, |
| 253 }; | 249 }; |
| 254 | 250 |
| 255 // Updates |state_|. All state transitions should use this call. | 251 // Updates |state_|. All state transitions should use this call. |
| 256 void SetState(State next_state); | 252 void SetState(State next_state); |
| 257 | 253 |
| 258 // Simple method used to make sure the pipeline is running normally. | 254 // Simple method used to make sure the pipeline is running normally. |
| 259 bool IsPipelineOk(); | 255 bool IsPipelineOk(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE; | 290 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE; |
| 295 | 291 |
| 296 // Initiates teardown sequence in response to a runtime error. | 292 // Initiates teardown sequence in response to a runtime error. |
| 297 // | 293 // |
| 298 // Safe to call from any thread. | 294 // Safe to call from any thread. |
| 299 void SetError(PipelineStatus error); | 295 void SetError(PipelineStatus error); |
| 300 | 296 |
| 301 // Callback executed when the natural size of the video has changed. | 297 // Callback executed when the natural size of the video has changed. |
| 302 void OnNaturalVideoSizeChanged(const gfx::Size& size); | 298 void OnNaturalVideoSizeChanged(const gfx::Size& size); |
| 303 | 299 |
| 304 // Callback executed when either of the renderers have ended. | 300 // Callbacks executed when a renderer has ended. |
| 305 void OnRendererEnded(); | 301 void OnAudioRendererEnded(); |
| 302 void OnVideoRendererEnded(); | |
| 306 | 303 |
| 307 // Callbacks executed by filters upon completing initialization. | 304 // Callbacks executed by filters upon completing initialization. |
| 308 void OnFilterInitialize(PipelineStatus status); | 305 void OnFilterInitialize(PipelineStatus status); |
| 309 | 306 |
| 310 // Callback executed by filters upon completing Play(), Pause(), Flush(), | 307 // Callback executed by filters upon completing Play(), Pause(), Flush(), |
| 311 // Seek() or Stop(). | 308 // Seek() or Stop(). |
| 312 void OnFilterStateTransition(PipelineStatus status); | 309 void OnFilterStateTransition(PipelineStatus status); |
| 313 | 310 |
| 314 // Callback executed by filters when completing teardown operations. | 311 // Callback executed by filters when completing teardown operations. |
| 315 void OnTeardownStateTransition(PipelineStatus status); | 312 void OnTeardownStateTransition(PipelineStatus status); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 | 347 |
| 351 // Carries out notifying filters that the playback rate has changed. | 348 // Carries out notifying filters that the playback rate has changed. |
| 352 void PlaybackRateChangedTask(float playback_rate); | 349 void PlaybackRateChangedTask(float playback_rate); |
| 353 | 350 |
| 354 // Carries out notifying filters that the volume has changed. | 351 // Carries out notifying filters that the volume has changed. |
| 355 void VolumeChangedTask(float volume); | 352 void VolumeChangedTask(float volume); |
| 356 | 353 |
| 357 // Carries out notifying filters that we are seeking to a new timestamp. | 354 // Carries out notifying filters that we are seeking to a new timestamp. |
| 358 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb); | 355 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb); |
| 359 | 356 |
| 360 // Carries out handling a notification from a renderer that it has ended. | 357 // Handles audio/video ended logic and running |ended_cb_|. |
| 361 void OnRendererEndedTask(); | 358 void DoAudioRendererEnded(); |
| 359 void DoVideoRendererEnded(); | |
| 360 void RunEndedCallbackIfNeeded(); | |
| 362 | 361 |
| 363 // Carries out disabling the audio renderer. | 362 // Carries out disabling the audio renderer. |
| 364 void AudioDisabledTask(); | 363 void AudioDisabledTask(); |
| 365 | 364 |
| 366 // Carries out advancing to the next filter during Play()/Pause()/Seek(). | 365 // Carries out advancing to the next filter during Play()/Pause()/Seek(). |
| 367 void FilterStateTransitionTask(); | 366 void FilterStateTransitionTask(); |
| 368 | 367 |
| 369 // Carries out advancing to the next teardown operation. | 368 // Carries out advancing to the next teardown operation. |
| 370 void TeardownStateTransitionTask(); | 369 void TeardownStateTransitionTask(); |
| 371 | 370 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 // The following data members are only accessed by tasks posted to | 511 // The following data members are only accessed by tasks posted to |
| 513 // |message_loop_|. | 512 // |message_loop_|. |
| 514 | 513 |
| 515 // Member that tracks the current state. | 514 // Member that tracks the current state. |
| 516 State state_; | 515 State state_; |
| 517 | 516 |
| 518 // For kSeeking we need to remember where we're seeking between filter | 517 // For kSeeking we need to remember where we're seeking between filter |
| 519 // replies. | 518 // replies. |
| 520 base::TimeDelta seek_timestamp_; | 519 base::TimeDelta seek_timestamp_; |
| 521 | 520 |
| 521 // Whether we've received the audio/video ended events. | |
| 522 bool audio_ended_; | |
| 523 bool video_ended_; | |
| 524 | |
| 522 // Set to true in DisableAudioRendererTask(). | 525 // Set to true in DisableAudioRendererTask(). |
| 523 bool audio_disabled_; | 526 bool audio_disabled_; |
| 524 | 527 |
| 525 // Filter collection as passed in by Start(). | 528 // Filter collection as passed in by Start(). |
| 526 scoped_ptr<FilterCollection> filter_collection_; | 529 scoped_ptr<FilterCollection> filter_collection_; |
| 527 | 530 |
| 528 // Callbacks for various pipeline operations. | 531 // Callbacks for various pipeline operations. |
| 529 PipelineStatusCB seek_cb_; | 532 PipelineStatusCB seek_cb_; |
| 530 base::Closure stop_cb_; | 533 base::Closure stop_cb_; |
| 531 PipelineStatusCB ended_cb_; | 534 PipelineStatusCB ended_cb_; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 559 base::Time creation_time_; | 562 base::Time creation_time_; |
| 560 | 563 |
| 561 scoped_ptr<SerialRunner> pending_callbacks_; | 564 scoped_ptr<SerialRunner> pending_callbacks_; |
| 562 | 565 |
| 563 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 566 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
| 564 }; | 567 }; |
| 565 | 568 |
| 566 } // namespace media | 569 } // namespace media |
| 567 | 570 |
| 568 #endif // MEDIA_BASE_PIPELINE_H_ | 571 #endif // MEDIA_BASE_PIPELINE_H_ |
| OLD | NEW |