Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Implementation of Pipeline & PipelineStatusNotification (an async-to-sync | 5 // Implementation of Pipeline & PipelineStatusNotification (an async-to-sync |
| 6 // callback adapter). | 6 // callback adapter). |
| 7 | 7 |
| 8 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ | 8 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ |
| 9 #define MEDIA_BASE_PIPELINE_IMPL_H_ | 9 #define MEDIA_BASE_PIPELINE_IMPL_H_ |
| 10 | 10 |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/synchronization/condition_variable.h" | 19 #include "base/synchronization/condition_variable.h" |
| 20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
| 21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 22 #include "base/time.h" | 22 #include "base/time.h" |
| 23 #include "media/base/clock.h" | 23 #include "media/base/clock.h" |
| 24 #include "media/base/composite_filter.h" | 24 #include "media/base/composite_filter.h" |
| 25 #include "media/base/demuxer.h" | 25 #include "media/base/demuxer.h" |
| 26 #include "media/base/download_rate_monitor.h" | |
| 26 #include "media/base/filter_host.h" | 27 #include "media/base/filter_host.h" |
| 27 #include "media/base/pipeline.h" | 28 #include "media/base/pipeline.h" |
| 28 #include "ui/gfx/size.h" | 29 #include "ui/gfx/size.h" |
| 29 | 30 |
| 30 namespace media { | 31 namespace media { |
| 31 | 32 |
| 32 class MediaLog; | 33 class MediaLog; |
| 33 | 34 |
| 34 // Adapter for using asynchronous Pipeline methods in code that wants to run | 35 // Adapter for using asynchronous Pipeline methods in code that wants to run |
| 35 // synchronously. To use, construct an instance of this class and pass the | 36 // synchronously. To use, construct an instance of this class and pass the |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 // Carries out notifying filters that the preload value has changed. | 255 // Carries out notifying filters that the preload value has changed. |
| 255 void PreloadChangedTask(Preload preload); | 256 void PreloadChangedTask(Preload preload); |
| 256 | 257 |
| 257 // Carries out notifying filters that we are seeking to a new timestamp. | 258 // Carries out notifying filters that we are seeking to a new timestamp. |
| 258 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_callback); | 259 void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_callback); |
| 259 | 260 |
| 260 // Carries out handling a notification from a filter that it has ended. | 261 // Carries out handling a notification from a filter that it has ended. |
| 261 void NotifyEndedTask(); | 262 void NotifyEndedTask(); |
| 262 | 263 |
| 263 // Carries out handling a notification of network event. | 264 // Carries out handling a notification of network event. |
| 264 void NotifyNetworkEventTask(bool is_downloading_data); | 265 void NotifyNetworkEventTask(NetworkEvent type, bool is_downloading_data); |
|
acolwell GONE FROM CHROMIUM
2011/11/09 00:50:22
Do we still need the bool?
vrk (LEFT CHROMIUM)
2011/11/11 02:51:06
Nope! Removed.
| |
| 265 | 266 |
| 266 // Carries out disabling the audio renderer. | 267 // Carries out disabling the audio renderer. |
| 267 void DisableAudioRendererTask(); | 268 void DisableAudioRendererTask(); |
| 268 | 269 |
| 269 // Carries out advancing to the next filter during Play()/Pause()/Seek(). | 270 // Carries out advancing to the next filter during Play()/Pause()/Seek(). |
| 270 void FilterStateTransitionTask(); | 271 void FilterStateTransitionTask(); |
| 271 | 272 |
| 272 // Carries out advancing to the next teardown operation. | 273 // Carries out advancing to the next teardown operation. |
| 273 void TeardownStateTransitionTask(); | 274 void TeardownStateTransitionTask(); |
| 274 | 275 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 // Initiates a Seek() on the |demuxer_| & |pipeline_filter_|. | 328 // Initiates a Seek() on the |demuxer_| & |pipeline_filter_|. |
| 328 void DoSeek(base::TimeDelta seek_timestamp); | 329 void DoSeek(base::TimeDelta seek_timestamp); |
| 329 | 330 |
| 330 // Called when |demuxer_| finishes seeking. If seeking was successful, | 331 // Called when |demuxer_| finishes seeking. If seeking was successful, |
| 331 // then Seek() is called on |pipeline_filter_|. | 332 // then Seek() is called on |pipeline_filter_|. |
| 332 void OnDemuxerSeekDone(base::TimeDelta seek_timestamp, | 333 void OnDemuxerSeekDone(base::TimeDelta seek_timestamp, |
| 333 PipelineStatus status); | 334 PipelineStatus status); |
| 334 | 335 |
| 335 void OnAudioUnderflow(); | 336 void OnAudioUnderflow(); |
| 336 | 337 |
| 338 // Called when |download_rate_monitor_| believes that the media can | |
| 339 // be played through without needing to pause to buffer. | |
| 340 void OnCanPlayThrough(); | |
| 341 | |
| 342 // Carries out the notification that the media can be played through without | |
| 343 // needing to pause to buffer. | |
| 344 void NotifyCanPlayThrough(); | |
| 345 | |
| 337 // Message loop used to execute pipeline tasks. | 346 // Message loop used to execute pipeline tasks. |
| 338 MessageLoop* message_loop_; | 347 MessageLoop* message_loop_; |
| 339 | 348 |
| 340 // MediaLog to which to log events. | 349 // MediaLog to which to log events. |
| 341 scoped_refptr<MediaLog> media_log_; | 350 scoped_refptr<MediaLog> media_log_; |
| 342 | 351 |
| 343 // Lock used to serialize access for the following data members. | 352 // Lock used to serialize access for the following data members. |
| 344 mutable base::Lock lock_; | 353 mutable base::Lock lock_; |
| 345 | 354 |
| 346 // Whether or not the pipeline is running. | 355 // Whether or not the pipeline is running. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 // initialization. | 481 // initialization. |
| 473 class PipelineInitState; | 482 class PipelineInitState; |
| 474 scoped_ptr<PipelineInitState> pipeline_init_state_; | 483 scoped_ptr<PipelineInitState> pipeline_init_state_; |
| 475 | 484 |
| 476 // Statistics. | 485 // Statistics. |
| 477 PipelineStatistics statistics_; | 486 PipelineStatistics statistics_; |
| 478 // Time of pipeline creation; is non-zero only until the pipeline first | 487 // Time of pipeline creation; is non-zero only until the pipeline first |
| 479 // reaches "kStarted", at which point it is used & zeroed out. | 488 // reaches "kStarted", at which point it is used & zeroed out. |
| 480 base::Time creation_time_; | 489 base::Time creation_time_; |
| 481 | 490 |
| 491 // Approximates the rate at which the media is being downloaded. | |
| 492 DownloadRateMonitor download_rate_monitor_; | |
| 493 | |
| 494 // True if the pipeline is actively downloading bytes, false otherwise. | |
| 495 bool is_downloading_data_; | |
| 496 | |
| 482 FRIEND_TEST_ALL_PREFIXES(PipelineImplTest, GetBufferedTime); | 497 FRIEND_TEST_ALL_PREFIXES(PipelineImplTest, GetBufferedTime); |
| 483 | 498 |
| 484 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); | 499 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); |
| 485 }; | 500 }; |
| 486 | 501 |
| 487 } // namespace media | 502 } // namespace media |
| 488 | 503 |
| 489 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ | 504 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ |
| OLD | NEW |