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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1541 if (!delegate_ || delegate_state_ == new_state) | 1542 if (!delegate_ || delegate_state_ == new_state) |
1542 return; | 1543 return; |
1543 | 1544 |
1544 delegate_state_ = new_state; | 1545 delegate_state_ = new_state; |
1545 | 1546 |
1546 switch (delegate_state_) { | 1547 switch (delegate_state_) { |
1547 case DelegateState::GONE: | 1548 case DelegateState::GONE: |
1548 delegate_->PlayerGone(delegate_id_); | 1549 delegate_->PlayerGone(delegate_id_); |
1549 break; | 1550 break; |
1550 case DelegateState::PLAYING: | 1551 case DelegateState::PLAYING: |
1551 delegate_->DidPlay(delegate_id_, hasVideo(), hasAudio(), false, | 1552 delegate_->DidPlay( |
1552 pipeline_.GetMediaDuration()); | 1553 delegate_id_, hasVideo(), hasAudio(), false, |
| 1554 media::DurationToMediaContentType(pipeline_.GetMediaDuration())); |
1553 break; | 1555 break; |
1554 case DelegateState::PAUSED: | 1556 case DelegateState::PAUSED: |
1555 delegate_->DidPause(delegate_id_, false); | 1557 delegate_->DidPause(delegate_id_, false); |
1556 break; | 1558 break; |
1557 case DelegateState::PAUSED_BUT_NOT_IDLE: | 1559 case DelegateState::PAUSED_BUT_NOT_IDLE: |
1558 // It doesn't really matter what happens when we enter this state, only | 1560 // It doesn't really matter what happens when we enter this state, only |
1559 // that we reset the idle timer when leaving it. | 1561 // that we reset the idle timer when leaving it. |
1560 // | 1562 // |
1561 // TODO(sandersd): Ideally the delegate would consider idleness and play | 1563 // TODO(sandersd): Ideally the delegate would consider idleness and play |
1562 // state as orthogonal properties so that we could avoid this. | 1564 // state as orthogonal properties so that we could avoid this. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 pipeline_metadata_.natural_size, | 1792 pipeline_metadata_.natural_size, |
1791 base::Bind(&GetCurrentTimeInternal, this))); | 1793 base::Bind(&GetCurrentTimeInternal, this))); |
1792 watch_time_reporter_->OnVolumeChange(volume_); | 1794 watch_time_reporter_->OnVolumeChange(volume_); |
1793 if (delegate_ && delegate_->IsHidden()) | 1795 if (delegate_ && delegate_->IsHidden()) |
1794 watch_time_reporter_->OnHidden(); | 1796 watch_time_reporter_->OnHidden(); |
1795 else | 1797 else |
1796 watch_time_reporter_->OnShown(); | 1798 watch_time_reporter_->OnShown(); |
1797 } | 1799 } |
1798 | 1800 |
1799 } // namespace media | 1801 } // namespace media |
OLD | NEW |