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/webrtc/video_destination_handler.h" | 5 #include "content/renderer/media/webrtc/video_destination_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 << "The image could not be mapped and is unusable."; | 94 << "The image could not be mapped and is unusable."; |
95 return; | 95 return; |
96 } | 96 } |
97 | 97 |
98 const SkBitmap* bitmap = image_data->GetMappedBitmap(); | 98 const SkBitmap* bitmap = image_data->GetMappedBitmap(); |
99 if (!bitmap) { | 99 if (!bitmap) { |
100 LOG(ERROR) << "PpFrameWriter::PutFrame - " | 100 LOG(ERROR) << "PpFrameWriter::PutFrame - " |
101 << "The image_data's mapped bitmap is NULL."; | 101 << "The image_data's mapped bitmap is NULL."; |
102 return; | 102 return; |
103 } | 103 } |
104 // We only support PP_IMAGEDATAFORMAT_BGRA_PREMUL at the moment. | |
105 DCHECK(image_data->format() == PP_IMAGEDATAFORMAT_BGRA_PREMUL); | |
fbarchard
2014/10/21 01:02:57
FYI our effects code is normally unattenuated.
| |
104 io_message_loop_->PostTaskAndReply( | 106 io_message_loop_->PostTaskAndReply( |
105 FROM_HERE, | 107 FROM_HERE, |
106 base::Bind(&FrameWriterDelegate::DeliverFrameOnIO, this, | 108 base::Bind(&FrameWriterDelegate::DeliverFrameOnIO, this, |
107 static_cast<uint8*>(bitmap->getPixels()), | 109 static_cast<uint8*>(bitmap->getPixels()), |
108 bitmap->rowBytes(), | 110 bitmap->rowBytes(), |
109 bitmap->width(), | 111 bitmap->width(), |
110 bitmap->height(), | 112 bitmap->height(), |
111 time_stamp_ns), | 113 time_stamp_ns), |
112 base::Bind(&FrameWriterDelegate::FrameDelivered, this, | 114 base::Bind(&FrameWriterDelegate::FrameDelivered, this, |
113 image_data)); | 115 image_data)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 // WebRtcVideoCapturerAdapter before the frame is delivered to libJingle. | 148 // WebRtcVideoCapturerAdapter before the frame is delivered to libJingle. |
147 // crbug/359587. | 149 // crbug/359587. |
148 scoped_refptr<media::VideoFrame> new_frame = | 150 scoped_refptr<media::VideoFrame> new_frame = |
149 frame_pool_.CreateFrame(media::VideoFrame::YV12, frame_size, | 151 frame_pool_.CreateFrame(media::VideoFrame::YV12, frame_size, |
150 gfx::Rect(frame_size), frame_size, timestamp); | 152 gfx::Rect(frame_size), frame_size, timestamp); |
151 media::VideoCaptureFormat format( | 153 media::VideoCaptureFormat format( |
152 frame_size, | 154 frame_size, |
153 MediaStreamVideoSource::kUnknownFrameRate, | 155 MediaStreamVideoSource::kUnknownFrameRate, |
154 media::PIXEL_FORMAT_YV12); | 156 media::PIXEL_FORMAT_YV12); |
155 | 157 |
156 libyuv::BGRAToI420(data, | 158 libyuv::ARGBToI420(data, |
fbarchard
2014/10/21 01:02:57
note that this has immediate performance benefit -
| |
157 stride, | 159 stride, |
158 new_frame->data(media::VideoFrame::kYPlane), | 160 new_frame->data(media::VideoFrame::kYPlane), |
159 new_frame->stride(media::VideoFrame::kYPlane), | 161 new_frame->stride(media::VideoFrame::kYPlane), |
160 new_frame->data(media::VideoFrame::kUPlane), | 162 new_frame->data(media::VideoFrame::kUPlane), |
161 new_frame->stride(media::VideoFrame::kUPlane), | 163 new_frame->stride(media::VideoFrame::kUPlane), |
162 new_frame->data(media::VideoFrame::kVPlane), | 164 new_frame->data(media::VideoFrame::kVPlane), |
163 new_frame->stride(media::VideoFrame::kVPlane), | 165 new_frame->stride(media::VideoFrame::kVPlane), |
164 frame_size.width(), frame_size.height()); | 166 frame_size.width(), frame_size.height()); |
165 | 167 |
166 // The local time when this frame is generated is unknown so give a null | 168 // The local time when this frame is generated is unknown so give a null |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 bool track_enabled = true; | 255 bool track_enabled = true; |
254 | 256 |
255 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( | 257 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( |
256 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), | 258 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), |
257 track_enabled)); | 259 track_enabled)); |
258 | 260 |
259 return true; | 261 return true; |
260 } | 262 } |
261 | 263 |
262 } // namespace content | 264 } // namespace content |
OLD | NEW |