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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/callback_helpers.h" | 15 #include "base/callback_helpers.h" |
16 #include "base/debug/alias.h" | 16 #include "base/debug/alias.h" |
17 #include "base/debug/crash_logging.h" | 17 #include "base/debug/crash_logging.h" |
18 #include "base/message_loop/message_loop_proxy.h" | |
19 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
20 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
21 #include "base/synchronization/waitable_event.h" | 20 #include "base/synchronization/waitable_event.h" |
| 21 #include "base/thread_task_runner_handle.h" |
22 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
23 #include "cc/blink/web_layer_impl.h" | 23 #include "cc/blink/web_layer_impl.h" |
24 #include "cc/layers/video_layer.h" | 24 #include "cc/layers/video_layer.h" |
25 #include "gpu/blink/webgraphicscontext3d_impl.h" | 25 #include "gpu/blink/webgraphicscontext3d_impl.h" |
26 #include "media/audio/null_audio_sink.h" | 26 #include "media/audio/null_audio_sink.h" |
27 #include "media/base/bind_to_current_loop.h" | 27 #include "media/base/bind_to_current_loop.h" |
28 #include "media/base/cdm_context.h" | 28 #include "media/base/cdm_context.h" |
29 #include "media/base/limits.h" | 29 #include "media/base/limits.h" |
30 #include "media/base/media_log.h" | 30 #include "media/base/media_log.h" |
31 #include "media/base/pipeline.h" | 31 #include "media/base/pipeline.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 blink::WebLocalFrame* frame, | 107 blink::WebLocalFrame* frame, |
108 blink::WebMediaPlayerClient* client, | 108 blink::WebMediaPlayerClient* client, |
109 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 109 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
110 scoped_ptr<RendererFactory> renderer_factory, | 110 scoped_ptr<RendererFactory> renderer_factory, |
111 CdmFactory* cdm_factory, | 111 CdmFactory* cdm_factory, |
112 const WebMediaPlayerParams& params) | 112 const WebMediaPlayerParams& params) |
113 : frame_(frame), | 113 : frame_(frame), |
114 network_state_(WebMediaPlayer::NetworkStateEmpty), | 114 network_state_(WebMediaPlayer::NetworkStateEmpty), |
115 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), | 115 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), |
116 preload_(BufferedDataSource::AUTO), | 116 preload_(BufferedDataSource::AUTO), |
117 main_task_runner_(base::MessageLoopProxy::current()), | 117 main_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
118 media_task_runner_(params.media_task_runner()), | 118 media_task_runner_(params.media_task_runner()), |
119 media_log_(params.media_log()), | 119 media_log_(params.media_log()), |
120 pipeline_(media_task_runner_, media_log_.get()), | 120 pipeline_(media_task_runner_, media_log_.get()), |
121 load_type_(LoadTypeURL), | 121 load_type_(LoadTypeURL), |
122 opaque_(false), | 122 opaque_(false), |
123 paused_(true), | 123 paused_(true), |
124 seeking_(false), | 124 seeking_(false), |
125 playback_rate_(0.0), | 125 playback_rate_(0.0), |
126 ended_(false), | 126 ended_(false), |
127 pending_seek_(false), | 127 pending_seek_(false), |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 | 1013 |
1014 // pause() may be called after playback has ended and the HTMLMediaElement | 1014 // pause() may be called after playback has ended and the HTMLMediaElement |
1015 // requires that currentTime() == duration() after ending. We want to ensure | 1015 // requires that currentTime() == duration() after ending. We want to ensure |
1016 // |paused_time_| matches currentTime() in this case or a future seek() may | 1016 // |paused_time_| matches currentTime() in this case or a future seek() may |
1017 // incorrectly discard what it thinks is a seek to the existing time. | 1017 // incorrectly discard what it thinks is a seek to the existing time. |
1018 paused_time_ = | 1018 paused_time_ = |
1019 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); | 1019 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); |
1020 } | 1020 } |
1021 | 1021 |
1022 } // namespace media | 1022 } // namespace media |
OLD | NEW |