OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/media/webmediaplayer_proxy.h" | 5 #include "webkit/media/webmediaplayer_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "media/base/pipeline_status.h" | 10 #include "media/base/pipeline_status.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 data_source_->Abort(); | 82 data_source_->Abort(); |
83 } | 83 } |
84 | 84 |
85 void WebMediaPlayerProxy::Detach() { | 85 void WebMediaPlayerProxy::Detach() { |
86 DCHECK(render_loop_->BelongsToCurrentThread()); | 86 DCHECK(render_loop_->BelongsToCurrentThread()); |
87 webmediaplayer_ = NULL; | 87 webmediaplayer_ = NULL; |
88 data_source_ = NULL; | 88 data_source_ = NULL; |
89 frame_provider_ = NULL; | 89 frame_provider_ = NULL; |
90 } | 90 } |
91 | 91 |
92 void WebMediaPlayerProxy::PipelineInitializationCallback( | |
93 PipelineStatus status) { | |
94 render_loop_->PostTask(FROM_HERE, base::Bind( | |
95 &WebMediaPlayerProxy::PipelineInitializationTask, this, status)); | |
96 } | |
97 | |
98 void WebMediaPlayerProxy::PipelineSeekCallback(PipelineStatus status) { | 92 void WebMediaPlayerProxy::PipelineSeekCallback(PipelineStatus status) { |
99 render_loop_->PostTask(FROM_HERE, base::Bind( | 93 render_loop_->PostTask(FROM_HERE, base::Bind( |
100 &WebMediaPlayerProxy::PipelineSeekTask, this, status)); | 94 &WebMediaPlayerProxy::PipelineSeekTask, this, status)); |
101 } | 95 } |
102 | 96 |
103 void WebMediaPlayerProxy::PipelineEndedCallback(PipelineStatus status) { | 97 void WebMediaPlayerProxy::PipelineEndedCallback(PipelineStatus status) { |
104 render_loop_->PostTask(FROM_HERE, base::Bind( | 98 render_loop_->PostTask(FROM_HERE, base::Bind( |
105 &WebMediaPlayerProxy::PipelineEndedTask, this, status)); | 99 &WebMediaPlayerProxy::PipelineEndedTask, this, status)); |
106 } | 100 } |
107 | 101 |
108 void WebMediaPlayerProxy::PipelineErrorCallback(PipelineStatus error) { | 102 void WebMediaPlayerProxy::PipelineErrorCallback(PipelineStatus error) { |
109 DCHECK_NE(error, media::PIPELINE_OK); | 103 DCHECK_NE(error, media::PIPELINE_OK); |
110 render_loop_->PostTask(FROM_HERE, base::Bind( | 104 render_loop_->PostTask(FROM_HERE, base::Bind( |
111 &WebMediaPlayerProxy::PipelineErrorTask, this, error)); | 105 &WebMediaPlayerProxy::PipelineErrorTask, this, error)); |
112 } | 106 } |
113 | 107 |
| 108 void WebMediaPlayerProxy::PipelineBufferingStateCallback( |
| 109 media::Pipeline::BufferingState buffering_state) { |
| 110 render_loop_->PostTask(FROM_HERE, base::Bind( |
| 111 &WebMediaPlayerProxy::PipelineBufferingStateTask, this, buffering_state)); |
| 112 } |
| 113 |
114 void WebMediaPlayerProxy::RepaintTask() { | 114 void WebMediaPlayerProxy::RepaintTask() { |
115 DCHECK(render_loop_->BelongsToCurrentThread()); | 115 DCHECK(render_loop_->BelongsToCurrentThread()); |
116 { | 116 { |
117 base::AutoLock auto_lock(lock_); | 117 base::AutoLock auto_lock(lock_); |
118 --outstanding_repaints_; | 118 --outstanding_repaints_; |
119 DCHECK_GE(outstanding_repaints_, 0); | 119 DCHECK_GE(outstanding_repaints_, 0); |
120 } | 120 } |
121 if (webmediaplayer_) { | 121 if (webmediaplayer_) { |
122 webmediaplayer_->Repaint(); | 122 webmediaplayer_->Repaint(); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 void WebMediaPlayerProxy::PipelineInitializationTask(PipelineStatus status) { | |
127 DCHECK(render_loop_->BelongsToCurrentThread()); | |
128 if (webmediaplayer_) | |
129 webmediaplayer_->OnPipelineInitialize(status); | |
130 } | |
131 | |
132 void WebMediaPlayerProxy::PipelineSeekTask(PipelineStatus status) { | 126 void WebMediaPlayerProxy::PipelineSeekTask(PipelineStatus status) { |
133 DCHECK(render_loop_->BelongsToCurrentThread()); | 127 DCHECK(render_loop_->BelongsToCurrentThread()); |
134 if (webmediaplayer_) | 128 if (webmediaplayer_) |
135 webmediaplayer_->OnPipelineSeek(status); | 129 webmediaplayer_->OnPipelineSeek(status); |
136 } | 130 } |
137 | 131 |
138 void WebMediaPlayerProxy::PipelineEndedTask(PipelineStatus status) { | 132 void WebMediaPlayerProxy::PipelineEndedTask(PipelineStatus status) { |
139 DCHECK(render_loop_->BelongsToCurrentThread()); | 133 DCHECK(render_loop_->BelongsToCurrentThread()); |
140 if (webmediaplayer_) | 134 if (webmediaplayer_) |
141 webmediaplayer_->OnPipelineEnded(status); | 135 webmediaplayer_->OnPipelineEnded(status); |
142 } | 136 } |
143 | 137 |
144 void WebMediaPlayerProxy::PipelineErrorTask(PipelineStatus error) { | 138 void WebMediaPlayerProxy::PipelineErrorTask(PipelineStatus error) { |
145 DCHECK(render_loop_->BelongsToCurrentThread()); | 139 DCHECK(render_loop_->BelongsToCurrentThread()); |
146 if (webmediaplayer_) | 140 if (webmediaplayer_) |
147 webmediaplayer_->OnPipelineError(error); | 141 webmediaplayer_->OnPipelineError(error); |
148 } | 142 } |
149 | 143 |
| 144 void WebMediaPlayerProxy::PipelineBufferingStateTask( |
| 145 media::Pipeline::BufferingState buffering_state) { |
| 146 DCHECK(render_loop_->BelongsToCurrentThread()); |
| 147 if (webmediaplayer_) |
| 148 webmediaplayer_->OnPipelineBufferingState(buffering_state); |
| 149 } |
| 150 |
150 void WebMediaPlayerProxy::SetOpaqueTask(bool opaque) { | 151 void WebMediaPlayerProxy::SetOpaqueTask(bool opaque) { |
151 DCHECK(render_loop_->BelongsToCurrentThread()); | 152 DCHECK(render_loop_->BelongsToCurrentThread()); |
152 if (webmediaplayer_) | 153 if (webmediaplayer_) |
153 webmediaplayer_->SetOpaque(opaque); | 154 webmediaplayer_->SetOpaque(opaque); |
154 } | 155 } |
155 | 156 |
156 void WebMediaPlayerProxy::GetCurrentFrame( | 157 void WebMediaPlayerProxy::GetCurrentFrame( |
157 scoped_refptr<media::VideoFrame>* frame_out) { | 158 scoped_refptr<media::VideoFrame>* frame_out) { |
158 if (frame_provider_) | 159 if (frame_provider_) |
159 frame_provider_->GetCurrentFrame(frame_out); | 160 frame_provider_->GetCurrentFrame(frame_out); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 const std::string& session_id, | 312 const std::string& session_id, |
312 scoped_array<uint8> init_data, | 313 scoped_array<uint8> init_data, |
313 int init_data_size) { | 314 int init_data_size) { |
314 DCHECK(render_loop_->BelongsToCurrentThread()); | 315 DCHECK(render_loop_->BelongsToCurrentThread()); |
315 if (webmediaplayer_) | 316 if (webmediaplayer_) |
316 webmediaplayer_->OnNeedKey(key_system, session_id, | 317 webmediaplayer_->OnNeedKey(key_system, session_id, |
317 init_data.Pass(), init_data_size); | 318 init_data.Pass(), init_data_size); |
318 } | 319 } |
319 | 320 |
320 } // namespace webkit_media | 321 } // namespace webkit_media |
OLD | NEW |