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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // - A waiting to non-waiting transition indicates preroll has completed | 319 // - A waiting to non-waiting transition indicates preroll has completed |
320 // and StartPlayback() should be called | 320 // and StartPlayback() should be called |
321 // - A non-waiting to waiting transition indicates underflow has occurred | 321 // - A non-waiting to waiting transition indicates underflow has occurred |
322 // and StartWaitingForEnoughData() should be called | 322 // and StartWaitingForEnoughData() should be called |
323 void BufferingStateChanged(BufferingState* buffering_state, | 323 void BufferingStateChanged(BufferingState* buffering_state, |
324 BufferingState new_buffering_state); | 324 BufferingState new_buffering_state); |
325 bool WaitingForEnoughData() const; | 325 bool WaitingForEnoughData() const; |
326 void StartWaitingForEnoughData(); | 326 void StartWaitingForEnoughData(); |
327 void StartPlayback(); | 327 void StartPlayback(); |
328 | 328 |
| 329 void PauseClockAndStopRendering_Locked(); |
329 void StartClockIfWaitingForTimeUpdate_Locked(); | 330 void StartClockIfWaitingForTimeUpdate_Locked(); |
330 | 331 |
331 // Task runner used to execute pipeline tasks. | 332 // Task runner used to execute pipeline tasks. |
332 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 333 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
333 | 334 |
334 // MediaLog to which to log events. | 335 // MediaLog to which to log events. |
335 scoped_refptr<MediaLog> media_log_; | 336 scoped_refptr<MediaLog> media_log_; |
336 | 337 |
337 // Lock used to serialize access for the following data members. | 338 // Lock used to serialize access for the following data members. |
338 mutable base::Lock lock_; | 339 mutable base::Lock lock_; |
(...skipping 19 matching lines...) Expand all Loading... |
358 float playback_rate_; | 359 float playback_rate_; |
359 | 360 |
360 // base::TickClock used by |clock_|. | 361 // base::TickClock used by |clock_|. |
361 base::DefaultTickClock default_tick_clock_; | 362 base::DefaultTickClock default_tick_clock_; |
362 | 363 |
363 // Reference clock. Keeps track of current playback time. Uses system | 364 // Reference clock. Keeps track of current playback time. Uses system |
364 // clock and linear interpolation, but can have its time manually set | 365 // clock and linear interpolation, but can have its time manually set |
365 // by filters. | 366 // by filters. |
366 scoped_ptr<Clock> clock_; | 367 scoped_ptr<Clock> clock_; |
367 | 368 |
368 // If this value is set to true, then |clock_| is paused and we are waiting | 369 enum ClockState { |
369 // for an update of the clock greater than or equal to the elapsed time to | 370 // Audio (if present) is not rendering. Clock isn't playing. |
370 // start the clock. | 371 CLOCK_PAUSED, |
371 bool waiting_for_clock_update_; | 372 |
| 373 // Audio (if present) is rendering. Clock isn't playing. |
| 374 CLOCK_WAITING_FOR_AUDIO_TIME_UPDATE, |
| 375 |
| 376 // Audio (if present) is rendering. Clock is playing. |
| 377 CLOCK_PLAYING, |
| 378 }; |
| 379 |
| 380 ClockState clock_state_; |
372 | 381 |
373 // Status of the pipeline. Initialized to PIPELINE_OK which indicates that | 382 // Status of the pipeline. Initialized to PIPELINE_OK which indicates that |
374 // the pipeline is operating correctly. Any other value indicates that the | 383 // the pipeline is operating correctly. Any other value indicates that the |
375 // pipeline is stopped or is stopping. Clients can call the Stop() method to | 384 // pipeline is stopped or is stopping. Clients can call the Stop() method to |
376 // reset the pipeline state, and restore this to PIPELINE_OK. | 385 // reset the pipeline state, and restore this to PIPELINE_OK. |
377 PipelineStatus status_; | 386 PipelineStatus status_; |
378 | 387 |
379 // The following data members are only accessed by tasks posted to | 388 // The following data members are only accessed by tasks posted to |
380 // |task_runner_|. | 389 // |task_runner_|. |
381 | 390 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 scoped_ptr<SerialRunner> pending_callbacks_; | 433 scoped_ptr<SerialRunner> pending_callbacks_; |
425 | 434 |
426 base::ThreadChecker thread_checker_; | 435 base::ThreadChecker thread_checker_; |
427 | 436 |
428 DISALLOW_COPY_AND_ASSIGN(Pipeline); | 437 DISALLOW_COPY_AND_ASSIGN(Pipeline); |
429 }; | 438 }; |
430 | 439 |
431 } // namespace media | 440 } // namespace media |
432 | 441 |
433 #endif // MEDIA_BASE_PIPELINE_H_ | 442 #endif // MEDIA_BASE_PIPELINE_H_ |
OLD | NEW |