OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "base/task_runner_util.h" | 24 #include "base/task_runner_util.h" |
25 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
26 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
28 #include "cc/blink/web_layer_impl.h" | 28 #include "cc/blink/web_layer_impl.h" |
29 #include "cc/layers/video_layer.h" | 29 #include "cc/layers/video_layer.h" |
30 #include "media/audio/null_audio_sink.h" | 30 #include "media/audio/null_audio_sink.h" |
31 #include "media/base/bind_to_current_loop.h" | 31 #include "media/base/bind_to_current_loop.h" |
32 #include "media/base/cdm_context.h" | 32 #include "media/base/cdm_context.h" |
33 #include "media/base/limits.h" | 33 #include "media/base/limits.h" |
| 34 #include "media/base/media_content_type.h" |
34 #include "media/base/media_log.h" | 35 #include "media/base/media_log.h" |
35 #include "media/base/media_switches.h" | 36 #include "media/base/media_switches.h" |
36 #include "media/base/text_renderer.h" | 37 #include "media/base/text_renderer.h" |
37 #include "media/base/timestamp_constants.h" | 38 #include "media/base/timestamp_constants.h" |
38 #include "media/base/video_frame.h" | 39 #include "media/base/video_frame.h" |
39 #include "media/blink/texttrack_impl.h" | 40 #include "media/blink/texttrack_impl.h" |
40 #include "media/blink/watch_time_reporter.h" | 41 #include "media/blink/watch_time_reporter.h" |
41 #include "media/blink/webaudiosourceprovider_impl.h" | 42 #include "media/blink/webaudiosourceprovider_impl.h" |
42 #include "media/blink/webcontentdecryptionmodule_impl.h" | 43 #include "media/blink/webcontentdecryptionmodule_impl.h" |
43 #include "media/blink/webinbandtexttrack_impl.h" | 44 #include "media/blink/webinbandtexttrack_impl.h" |
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 if (!delegate_ || delegate_state_ == new_state) | 1557 if (!delegate_ || delegate_state_ == new_state) |
1557 return; | 1558 return; |
1558 | 1559 |
1559 delegate_state_ = new_state; | 1560 delegate_state_ = new_state; |
1560 | 1561 |
1561 switch (delegate_state_) { | 1562 switch (delegate_state_) { |
1562 case DelegateState::GONE: | 1563 case DelegateState::GONE: |
1563 delegate_->PlayerGone(delegate_id_); | 1564 delegate_->PlayerGone(delegate_id_); |
1564 break; | 1565 break; |
1565 case DelegateState::PLAYING: | 1566 case DelegateState::PLAYING: |
1566 delegate_->DidPlay(delegate_id_, hasVideo(), hasAudio(), false, | 1567 delegate_->DidPlay( |
1567 pipeline_.GetMediaDuration()); | 1568 delegate_id_, hasVideo(), hasAudio(), false, |
| 1569 media::DurationToMediaContentType(pipeline_.GetMediaDuration())); |
1568 break; | 1570 break; |
1569 case DelegateState::PAUSED: | 1571 case DelegateState::PAUSED: |
1570 delegate_->DidPause(delegate_id_, false); | 1572 delegate_->DidPause(delegate_id_, false); |
1571 break; | 1573 break; |
1572 case DelegateState::PAUSED_BUT_NOT_IDLE: | 1574 case DelegateState::PAUSED_BUT_NOT_IDLE: |
1573 // It doesn't really matter what happens when we enter this state, only | 1575 // It doesn't really matter what happens when we enter this state, only |
1574 // that we reset the idle timer when leaving it. | 1576 // that we reset the idle timer when leaving it. |
1575 // | 1577 // |
1576 // TODO(sandersd): Ideally the delegate would consider idleness and play | 1578 // TODO(sandersd): Ideally the delegate would consider idleness and play |
1577 // state as orthogonal properties so that we could avoid this. | 1579 // state as orthogonal properties so that we could avoid this. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 pipeline_metadata_.natural_size, | 1807 pipeline_metadata_.natural_size, |
1806 base::Bind(&GetCurrentTimeInternal, this))); | 1808 base::Bind(&GetCurrentTimeInternal, this))); |
1807 watch_time_reporter_->OnVolumeChange(volume_); | 1809 watch_time_reporter_->OnVolumeChange(volume_); |
1808 if (delegate_ && delegate_->IsHidden()) | 1810 if (delegate_ && delegate_->IsHidden()) |
1809 watch_time_reporter_->OnHidden(); | 1811 watch_time_reporter_->OnHidden(); |
1810 else | 1812 else |
1811 watch_time_reporter_->OnShown(); | 1813 watch_time_reporter_->OnShown(); |
1812 } | 1814 } |
1813 | 1815 |
1814 } // namespace media | 1816 } // namespace media |
OLD | NEW |