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 <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_to_current_loop.h" |
13 #include "base/callback.h" | 14 #include "base/callback.h" |
14 #include "base/callback_helpers.h" | 15 #include "base/callback_helpers.h" |
15 #include "base/debug/alias.h" | 16 #include "base/debug/alias.h" |
16 #include "base/debug/crash_logging.h" | 17 #include "base/debug/crash_logging.h" |
17 #include "base/float_util.h" | 18 #include "base/float_util.h" |
18 #include "base/message_loop/message_loop_proxy.h" | 19 #include "base/message_loop/message_loop_proxy.h" |
19 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
20 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
21 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
22 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
23 #include "cc/blink/web_layer_impl.h" | 24 #include "cc/blink/web_layer_impl.h" |
24 #include "cc/layers/video_layer.h" | 25 #include "cc/layers/video_layer.h" |
25 #include "gpu/blink/webgraphicscontext3d_impl.h" | 26 #include "gpu/blink/webgraphicscontext3d_impl.h" |
26 #include "media/audio/null_audio_sink.h" | 27 #include "media/audio/null_audio_sink.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" |
32 #include "media/base/text_renderer.h" | 32 #include "media/base/text_renderer.h" |
33 #include "media/base/video_frame.h" | 33 #include "media/base/video_frame.h" |
34 #include "media/blink/buffered_data_source.h" | 34 #include "media/blink/buffered_data_source.h" |
35 #include "media/blink/encrypted_media_player_support.h" | 35 #include "media/blink/encrypted_media_player_support.h" |
36 #include "media/blink/texttrack_impl.h" | 36 #include "media/blink/texttrack_impl.h" |
37 #include "media/blink/webaudiosourceprovider_impl.h" | 37 #include "media/blink/webaudiosourceprovider_impl.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 static_assert(static_cast<int>(WebMediaPlayer::CORSMode ## name) == \ | 90 static_assert(static_cast<int>(WebMediaPlayer::CORSMode ## name) == \ |
91 static_cast<int>(BufferedResourceLoader::k ## name), \ | 91 static_cast<int>(BufferedResourceLoader::k ## name), \ |
92 "mismatching enum values: " #name) | 92 "mismatching enum values: " #name) |
93 STATIC_ASSERT_MATCHING_ENUM(Unspecified); | 93 STATIC_ASSERT_MATCHING_ENUM(Unspecified); |
94 STATIC_ASSERT_MATCHING_ENUM(Anonymous); | 94 STATIC_ASSERT_MATCHING_ENUM(Anonymous); |
95 STATIC_ASSERT_MATCHING_ENUM(UseCredentials); | 95 STATIC_ASSERT_MATCHING_ENUM(UseCredentials); |
96 #undef STATIC_ASSERT_MATCHING_ENUM | 96 #undef STATIC_ASSERT_MATCHING_ENUM |
97 | 97 |
98 #define BIND_TO_RENDER_LOOP(function) \ | 98 #define BIND_TO_RENDER_LOOP(function) \ |
99 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \ | 99 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \ |
100 BindToCurrentLoop(base::Bind(function, AsWeakPtr()))) | 100 base::BindToCurrentLoop(base::Bind(function, AsWeakPtr()))) |
101 | 101 |
102 #define BIND_TO_RENDER_LOOP1(function, arg1) \ | 102 #define BIND_TO_RENDER_LOOP1(function, arg1) \ |
103 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \ | 103 (DCHECK(main_task_runner_->BelongsToCurrentThread()), \ |
104 BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1))) | 104 base::BindToCurrentLoop(base::Bind(function, AsWeakPtr(), arg1))) |
105 | 105 |
106 WebMediaPlayerImpl::WebMediaPlayerImpl( | 106 WebMediaPlayerImpl::WebMediaPlayerImpl( |
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), |
(...skipping 898 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 |