OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/renderer/media/pepper_to_video_track_adapter.h" | 5 #include "content/renderer/media/pepper_to_video_track_adapter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 << "The image could not be mapped and is unusable."; | 161 << "The image could not be mapped and is unusable."; |
162 return; | 162 return; |
163 } | 163 } |
164 SkBitmap bitmap(image_data->GetMappedBitmap()); | 164 SkBitmap bitmap(image_data->GetMappedBitmap()); |
165 if (bitmap.empty()) { | 165 if (bitmap.empty()) { |
166 LOG(ERROR) << "PpFrameWriter::PutFrame - " | 166 LOG(ERROR) << "PpFrameWriter::PutFrame - " |
167 << "The image_data's mapped bitmap failed."; | 167 << "The image_data's mapped bitmap failed."; |
168 return; | 168 return; |
169 } | 169 } |
170 | 170 |
171 SkAutoLockPixels src_lock(bitmap); | |
172 const uint8_t* src_data = static_cast<uint8_t*>(bitmap.getPixels()); | 171 const uint8_t* src_data = static_cast<uint8_t*>(bitmap.getPixels()); |
173 const int src_stride = static_cast<int>(bitmap.rowBytes()); | 172 const int src_stride = static_cast<int>(bitmap.rowBytes()); |
174 const int width = bitmap.width(); | 173 const int width = bitmap.width(); |
175 const int height = bitmap.height(); | 174 const int height = bitmap.height(); |
176 | 175 |
177 // We only support PP_IMAGEDATAFORMAT_BGRA_PREMUL at the moment. | 176 // We only support PP_IMAGEDATAFORMAT_BGRA_PREMUL at the moment. |
178 DCHECK(image_data->format() == PP_IMAGEDATAFORMAT_BGRA_PREMUL); | 177 DCHECK(image_data->format() == PP_IMAGEDATAFORMAT_BGRA_PREMUL); |
179 | 178 |
180 const gfx::Size frame_size(width, height); | 179 const gfx::Size frame_size(width, height); |
181 | 180 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 263 |
265 bool track_enabled = true; | 264 bool track_enabled = true; |
266 stream.AddTrack(MediaStreamVideoTrack::CreateVideoTrack( | 265 stream.AddTrack(MediaStreamVideoTrack::CreateVideoTrack( |
267 writer, MediaStreamVideoSource::ConstraintsCallback(), track_enabled)); | 266 writer, MediaStreamVideoSource::ConstraintsCallback(), track_enabled)); |
268 | 267 |
269 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); | 268 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); |
270 return true; | 269 return true; |
271 } | 270 } |
272 | 271 |
273 } // namespace content | 272 } // namespace content |
OLD | NEW |