| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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. | 5 // Implementation of Pipeline. |
| 6 | 6 |
| 7 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ | 7 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ |
| 8 #define MEDIA_BASE_PIPELINE_IMPL_H_ | 8 #define MEDIA_BASE_PIPELINE_IMPL_H_ |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
| 16 #include "base/thread.h" | 16 #include "base/thread.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "media/base/clock_impl.h" | 18 #include "media/base/clock_impl.h" |
| 19 #include "media/base/filter_host.h" | 19 #include "media/base/filter_host.h" |
| 20 #include "media/base/pipeline.h" | 20 #include "media/base/pipeline.h" |
| 21 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 21 | 22 |
| 22 namespace media { | 23 namespace media { |
| 23 | 24 |
| 24 | 25 |
| 25 // PipelineImpl runs the media pipeline. Filters are created and called on the | 26 // PipelineImpl runs the media pipeline. Filters are created and called on the |
| 26 // message loop injected into this object. PipelineImpl works like a state | 27 // message loop injected into this object. PipelineImpl works like a state |
| 27 // machine to perform asynchronous initialization, pausing, seeking and playing. | 28 // machine to perform asynchronous initialization, pausing, seeking and playing. |
| 28 // | 29 // |
| 29 // Here's a state diagram that describes the lifetime of this object. | 30 // Here's a state diagram that describes the lifetime of this object. |
| 30 // | 31 // |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 // replies. | 379 // replies. |
| 379 base::TimeDelta seek_timestamp_; | 380 base::TimeDelta seek_timestamp_; |
| 380 | 381 |
| 381 // For GetCurrentBytes()/SetCurrentBytes() we need to know what byte we are | 382 // For GetCurrentBytes()/SetCurrentBytes() we need to know what byte we are |
| 382 // currently reading. | 383 // currently reading. |
| 383 int64 current_bytes_; | 384 int64 current_bytes_; |
| 384 | 385 |
| 385 // Keep track of the maximum buffered position so the buffering appears | 386 // Keep track of the maximum buffered position so the buffering appears |
| 386 // smooth. | 387 // smooth. |
| 387 // TODO(vrk): This is a hack. | 388 // TODO(vrk): This is a hack. |
| 388 double max_buffered_time_; | 389 base::TimeDelta max_buffered_time_; |
| 389 | 390 |
| 390 // Filter factory as passed in by Start(). | 391 // Filter factory as passed in by Start(). |
| 391 scoped_refptr<FilterFactory> filter_factory_; | 392 scoped_refptr<FilterFactory> filter_factory_; |
| 392 | 393 |
| 393 // URL for the data source as passed in by Start(). | 394 // URL for the data source as passed in by Start(). |
| 394 std::string url_; | 395 std::string url_; |
| 395 | 396 |
| 396 // Callbacks for various pipeline operations. | 397 // Callbacks for various pipeline operations. |
| 397 scoped_ptr<PipelineCallback> seek_callback_; | 398 scoped_ptr<PipelineCallback> seek_callback_; |
| 398 scoped_ptr<PipelineCallback> stop_callback_; | 399 scoped_ptr<PipelineCallback> stop_callback_; |
| 399 scoped_ptr<PipelineCallback> ended_callback_; | 400 scoped_ptr<PipelineCallback> ended_callback_; |
| 400 scoped_ptr<PipelineCallback> error_callback_; | 401 scoped_ptr<PipelineCallback> error_callback_; |
| 401 scoped_ptr<PipelineCallback> network_callback_; | 402 scoped_ptr<PipelineCallback> network_callback_; |
| 402 | 403 |
| 403 // Vector of our filters and map maintaining the relationship between the | 404 // Vector of our filters and map maintaining the relationship between the |
| 404 // FilterType and the filter itself. | 405 // FilterType and the filter itself. |
| 405 typedef std::vector<scoped_refptr<MediaFilter> > FilterVector; | 406 typedef std::vector<scoped_refptr<MediaFilter> > FilterVector; |
| 406 FilterVector filters_; | 407 FilterVector filters_; |
| 407 | 408 |
| 408 typedef std::map<FilterType, scoped_refptr<MediaFilter> > FilterTypeMap; | 409 typedef std::map<FilterType, scoped_refptr<MediaFilter> > FilterTypeMap; |
| 409 FilterTypeMap filter_types_; | 410 FilterTypeMap filter_types_; |
| 410 | 411 |
| 411 // Vector of threads owned by the pipeline and being used by filters. | 412 // Vector of threads owned by the pipeline and being used by filters. |
| 412 typedef std::vector<base::Thread*> FilterThreadVector; | 413 typedef std::vector<base::Thread*> FilterThreadVector; |
| 413 FilterThreadVector filter_threads_; | 414 FilterThreadVector filter_threads_; |
| 414 | 415 |
| 416 FRIEND_TEST(PipelineImplTest, GetBufferedTime); |
| 415 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); | 417 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); |
| 416 }; | 418 }; |
| 417 | 419 |
| 418 } // namespace media | 420 } // namespace media |
| 419 | 421 |
| 420 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ | 422 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ |
| OLD | NEW |