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/webaudiosourceprovider_impl.h" | 41 #include "media/blink/webaudiosourceprovider_impl.h" |
41 #include "media/blink/webcontentdecryptionmodule_impl.h" | 42 #include "media/blink/webcontentdecryptionmodule_impl.h" |
42 #include "media/blink/webinbandtexttrack_impl.h" | 43 #include "media/blink/webinbandtexttrack_impl.h" |
43 #include "media/blink/webmediaplayer_delegate.h" | 44 #include "media/blink/webmediaplayer_delegate.h" |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 if (!delegate_ || delegate_state_ == new_state) | 1472 if (!delegate_ || delegate_state_ == new_state) |
1472 return; | 1473 return; |
1473 | 1474 |
1474 delegate_state_ = new_state; | 1475 delegate_state_ = new_state; |
1475 | 1476 |
1476 switch (delegate_state_) { | 1477 switch (delegate_state_) { |
1477 case DelegateState::GONE: | 1478 case DelegateState::GONE: |
1478 delegate_->PlayerGone(delegate_id_); | 1479 delegate_->PlayerGone(delegate_id_); |
1479 break; | 1480 break; |
1480 case DelegateState::PLAYING: | 1481 case DelegateState::PLAYING: |
1481 delegate_->DidPlay(delegate_id_, hasVideo(), hasAudio(), false, | 1482 delegate_->DidPlay( |
1482 pipeline_.GetMediaDuration()); | 1483 delegate_id_, hasVideo(), hasAudio(), false, |
| 1484 media::DurationToMediaContentType(pipeline_.GetMediaDuration())); |
1483 break; | 1485 break; |
1484 case DelegateState::PAUSED: | 1486 case DelegateState::PAUSED: |
1485 delegate_->DidPause(delegate_id_, false); | 1487 delegate_->DidPause(delegate_id_, false); |
1486 break; | 1488 break; |
1487 case DelegateState::PAUSED_BUT_NOT_IDLE: | 1489 case DelegateState::PAUSED_BUT_NOT_IDLE: |
1488 // It doesn't really matter what happens when we enter this state, only | 1490 // It doesn't really matter what happens when we enter this state, only |
1489 // that we reset the idle timer when leaving it. | 1491 // that we reset the idle timer when leaving it. |
1490 // | 1492 // |
1491 // TODO(sandersd): Ideally the delegate would consider idleness and play | 1493 // TODO(sandersd): Ideally the delegate would consider idleness and play |
1492 // state as orthogonal properties so that we could avoid this. | 1494 // state as orthogonal properties so that we could avoid this. |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 if (isRemote()) | 1692 if (isRemote()) |
1691 return; | 1693 return; |
1692 #endif | 1694 #endif |
1693 | 1695 |
1694 // Idle timeout chosen arbitrarily. | 1696 // Idle timeout chosen arbitrarily. |
1695 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), | 1697 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), |
1696 this, &WebMediaPlayerImpl::OnPause); | 1698 this, &WebMediaPlayerImpl::OnPause); |
1697 } | 1699 } |
1698 | 1700 |
1699 } // namespace media | 1701 } // namespace media |
OLD | NEW |