| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (frame_provider_) | 100 if (frame_provider_) |
| 101 frame_provider_->GetCurrentFrame(frame_out); | 101 frame_provider_->GetCurrentFrame(frame_out); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void WebMediaPlayerProxy::PutCurrentFrame( | 104 void WebMediaPlayerProxy::PutCurrentFrame( |
| 105 scoped_refptr<media::VideoFrame> frame) { | 105 scoped_refptr<media::VideoFrame> frame) { |
| 106 if (frame_provider_) | 106 if (frame_provider_) |
| 107 frame_provider_->PutCurrentFrame(frame); | 107 frame_provider_->PutCurrentFrame(frame); |
| 108 } | 108 } |
| 109 | 109 |
| 110 | |
| 111 void WebMediaPlayerProxy::KeyAdded(const std::string& key_system, | |
| 112 const std::string& session_id) { | |
| 113 render_loop_->PostTask(FROM_HERE, base::Bind( | |
| 114 &WebMediaPlayerProxy::KeyAddedTask, this, key_system, session_id)); | |
| 115 } | |
| 116 | |
| 117 void WebMediaPlayerProxy::KeyError(const std::string& key_system, | |
| 118 const std::string& session_id, | |
| 119 media::Decryptor::KeyError error_code, | |
| 120 int system_code) { | |
| 121 render_loop_->PostTask(FROM_HERE, base::Bind( | |
| 122 &WebMediaPlayerProxy::KeyErrorTask, this, key_system, session_id, | |
| 123 error_code, system_code)); | |
| 124 } | |
| 125 | |
| 126 void WebMediaPlayerProxy::KeyMessage(const std::string& key_system, | |
| 127 const std::string& session_id, | |
| 128 const std::string& message, | |
| 129 const std::string& default_url) { | |
| 130 render_loop_->PostTask(FROM_HERE, base::Bind( | |
| 131 &WebMediaPlayerProxy::KeyMessageTask, this, key_system, session_id, | |
| 132 message, default_url)); | |
| 133 } | |
| 134 | |
| 135 void WebMediaPlayerProxy::NeedKey(const std::string& key_system, | |
| 136 const std::string& session_id, | |
| 137 const std::string& type, | |
| 138 scoped_array<uint8> init_data, | |
| 139 int init_data_size) { | |
| 140 render_loop_->PostTask(FROM_HERE, base::Bind( | |
| 141 &WebMediaPlayerProxy::NeedKeyTask, this, key_system, session_id, type, | |
| 142 base::Passed(&init_data), init_data_size)); | |
| 143 } | |
| 144 | |
| 145 void WebMediaPlayerProxy::KeyAddedTask(const std::string& key_system, | |
| 146 const std::string& session_id) { | |
| 147 DCHECK(render_loop_->BelongsToCurrentThread()); | |
| 148 if (webmediaplayer_) | |
| 149 webmediaplayer_->OnKeyAdded(key_system, session_id); | |
| 150 } | |
| 151 | |
| 152 void WebMediaPlayerProxy::KeyErrorTask(const std::string& key_system, | |
| 153 const std::string& session_id, | |
| 154 media::Decryptor::KeyError error_code, | |
| 155 int system_code) { | |
| 156 DCHECK(render_loop_->BelongsToCurrentThread()); | |
| 157 if (webmediaplayer_) | |
| 158 webmediaplayer_->OnKeyError(key_system, session_id, | |
| 159 error_code, system_code); | |
| 160 } | |
| 161 | |
| 162 void WebMediaPlayerProxy::KeyMessageTask(const std::string& key_system, | |
| 163 const std::string& session_id, | |
| 164 const std::string& message, | |
| 165 const std::string& default_url) { | |
| 166 DCHECK(render_loop_->BelongsToCurrentThread()); | |
| 167 if (webmediaplayer_) { | |
| 168 const GURL default_url_gurl(default_url); | |
| 169 DLOG_IF(WARNING, !default_url.empty() && !default_url_gurl.is_valid()) | |
| 170 << "Invalid URL in default_url: " << default_url; | |
| 171 webmediaplayer_->OnKeyMessage(key_system, session_id, message, | |
| 172 default_url_gurl); | |
| 173 } | |
| 174 } | |
| 175 | |
| 176 void WebMediaPlayerProxy::NeedKeyTask(const std::string& key_system, | |
| 177 const std::string& session_id, | |
| 178 const std::string& type, | |
| 179 scoped_array<uint8> init_data, | |
| 180 int init_data_size) { | |
| 181 DCHECK(render_loop_->BelongsToCurrentThread()); | |
| 182 if (webmediaplayer_) | |
| 183 webmediaplayer_->OnNeedKey(key_system, session_id, type, | |
| 184 init_data.Pass(), init_data_size); | |
| 185 } | |
| 186 | |
| 187 } // namespace webkit_media | 110 } // namespace webkit_media |
| OLD | NEW |