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" |
11 #include "base/synchronization/condition_variable.h" | 11 #include "base/synchronization/condition_variable.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "media/base/demuxer.h" | 13 #include "media/base/demuxer.h" |
14 #include "media/base/download_rate_monitor.h" | |
15 #include "media/base/filter_host.h" | 14 #include "media/base/filter_host.h" |
16 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
17 #include "media/base/pipeline_status.h" | 16 #include "media/base/pipeline_status.h" |
18 #include "media/base/ranges.h" | 17 #include "media/base/ranges.h" |
19 #include "ui/gfx/size.h" | 18 #include "ui/gfx/size.h" |
20 | 19 |
21 class MessageLoop; | 20 class MessageLoop; |
22 | 21 |
23 namespace base { | 22 namespace base { |
24 class MessageLoopProxy; | 23 class MessageLoopProxy; |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 // Initiates a Seek() on the |demuxer_| & |pipeline_filter_|. | 445 // Initiates a Seek() on the |demuxer_| & |pipeline_filter_|. |
447 void DoSeek(base::TimeDelta seek_timestamp); | 446 void DoSeek(base::TimeDelta seek_timestamp); |
448 | 447 |
449 // Called when |demuxer_| finishes seeking. If seeking was successful, | 448 // Called when |demuxer_| finishes seeking. If seeking was successful, |
450 // then Seek() is called on |pipeline_filter_|. | 449 // then Seek() is called on |pipeline_filter_|. |
451 void OnDemuxerSeekDone(base::TimeDelta seek_timestamp, | 450 void OnDemuxerSeekDone(base::TimeDelta seek_timestamp, |
452 PipelineStatus status); | 451 PipelineStatus status); |
453 | 452 |
454 void OnAudioUnderflow(); | 453 void OnAudioUnderflow(); |
455 | 454 |
456 // Called when |download_rate_monitor_| believes that the media can | |
457 // be played through without needing to pause to buffer. | |
458 void OnCanPlayThrough(); | |
459 | |
460 // Carries out the notification that the media can be played through without | |
461 // needing to pause to buffer. | |
462 void NotifyCanPlayThrough(); | |
463 | |
464 void StartClockIfWaitingForTimeUpdate_Locked(); | 455 void StartClockIfWaitingForTimeUpdate_Locked(); |
465 | 456 |
466 // Report pipeline |status| through |cb| avoiding duplicate error reporting. | 457 // Report pipeline |status| through |cb| avoiding duplicate error reporting. |
467 void ReportStatus(const PipelineStatusCB& cb, PipelineStatus status); | 458 void ReportStatus(const PipelineStatusCB& cb, PipelineStatus status); |
468 | 459 |
469 // Message loop used to execute pipeline tasks. | 460 // Message loop used to execute pipeline tasks. |
470 scoped_refptr<base::MessageLoopProxy> message_loop_; | 461 scoped_refptr<base::MessageLoopProxy> message_loop_; |
471 | 462 |
472 // MediaLog to which to log events. | 463 // MediaLog to which to log events. |
473 scoped_refptr<MediaLog> media_log_; | 464 scoped_refptr<MediaLog> media_log_; |
(...skipping 24 matching lines...) Expand all Loading... |
498 | 489 |
499 // Approximate time ranges of buffered media. | 490 // Approximate time ranges of buffered media. |
500 Ranges<base::TimeDelta> buffered_time_ranges_; | 491 Ranges<base::TimeDelta> buffered_time_ranges_; |
501 | 492 |
502 // Total size of the media. Set by filters. | 493 // Total size of the media. Set by filters. |
503 int64 total_bytes_; | 494 int64 total_bytes_; |
504 | 495 |
505 // Video's natural width and height. Set by filters. | 496 // Video's natural width and height. Set by filters. |
506 gfx::Size natural_size_; | 497 gfx::Size natural_size_; |
507 | 498 |
508 // Set by the demuxer to indicate whether the data source is a streaming | |
509 // source. | |
510 bool streaming_; | |
511 | |
512 // Indicates whether the data source is local, such as a local media file | |
513 // from disk or a local webcam stream. | |
514 bool local_source_; | |
515 | |
516 // Current volume level (from 0.0f to 1.0f). This value is set immediately | 499 // Current volume level (from 0.0f to 1.0f). This value is set immediately |
517 // via SetVolume() and a task is dispatched on the message loop to notify the | 500 // via SetVolume() and a task is dispatched on the message loop to notify the |
518 // filters. | 501 // filters. |
519 float volume_; | 502 float volume_; |
520 | 503 |
521 // Current playback rate (>= 0.0f). This value is set immediately via | 504 // Current playback rate (>= 0.0f). This value is set immediately via |
522 // SetPlaybackRate() and a task is dispatched on the message loop to notify | 505 // SetPlaybackRate() and a task is dispatched on the message loop to notify |
523 // the filters. | 506 // the filters. |
524 float playback_rate_; | 507 float playback_rate_; |
525 | 508 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 // initialization. | 582 // initialization. |
600 struct PipelineInitState; | 583 struct PipelineInitState; |
601 scoped_ptr<PipelineInitState> pipeline_init_state_; | 584 scoped_ptr<PipelineInitState> pipeline_init_state_; |
602 | 585 |
603 // Statistics. | 586 // Statistics. |
604 PipelineStatistics statistics_; | 587 PipelineStatistics statistics_; |
605 // Time of pipeline creation; is non-zero only until the pipeline first | 588 // Time of pipeline creation; is non-zero only until the pipeline first |
606 // reaches "kStarted", at which point it is used & zeroed out. | 589 // reaches "kStarted", at which point it is used & zeroed out. |
607 base::Time creation_time_; | 590 base::Time creation_time_; |
608 | 591 |
609 // Approximates the rate at which the media is being downloaded. | |
610 DownloadRateMonitor download_rate_monitor_; | |
611 | |
612 // True if the pipeline is actively downloading bytes, false otherwise. | |
613 bool is_downloading_data_; | |
614 | |
615 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 592 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
616 }; | 593 }; |
617 | 594 |
618 } // namespace media | 595 } // namespace media |
619 | 596 |
620 #endif // MEDIA_BASE_PIPELINE_H_ | 597 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |