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/logging.h" | 10 #include "base/logging.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 DCHECK(image_data->format() == PP_IMAGEDATAFORMAT_BGRA_PREMUL); | 137 DCHECK(image_data->format() == PP_IMAGEDATAFORMAT_BGRA_PREMUL); |
138 | 138 |
139 const gfx::Size frame_size(width, height); | 139 const gfx::Size frame_size(width, height); |
140 | 140 |
141 if (state() != MediaStreamVideoSource::STARTED) | 141 if (state() != MediaStreamVideoSource::STARTED) |
142 return; | 142 return; |
143 | 143 |
144 const base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds( | 144 const base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds( |
145 time_stamp_ns / base::Time::kNanosecondsPerMicrosecond); | 145 time_stamp_ns / base::Time::kNanosecondsPerMicrosecond); |
146 | 146 |
147 scoped_refptr<media::VideoFrame> new_frame = | 147 scoped_refptr<media::VideoFrame> new_frame = frame_pool_.CreateFrame( |
148 frame_pool_.CreateFrame(media::VideoFrame::YV12, frame_size, | 148 media::VideoFrame::YV12, frame_size, gfx::Rect(frame_size), frame_size, |
149 gfx::Rect(frame_size), frame_size, timestamp); | 149 timestamp, false); |
150 | 150 |
151 libyuv::ARGBToI420(src_data, | 151 libyuv::ARGBToI420(src_data, |
152 src_stride, | 152 src_stride, |
153 new_frame->data(media::VideoFrame::kYPlane), | 153 new_frame->data(media::VideoFrame::kYPlane), |
154 new_frame->stride(media::VideoFrame::kYPlane), | 154 new_frame->stride(media::VideoFrame::kYPlane), |
155 new_frame->data(media::VideoFrame::kUPlane), | 155 new_frame->data(media::VideoFrame::kUPlane), |
156 new_frame->stride(media::VideoFrame::kUPlane), | 156 new_frame->stride(media::VideoFrame::kUPlane), |
157 new_frame->data(media::VideoFrame::kVPlane), | 157 new_frame->data(media::VideoFrame::kVPlane), |
158 new_frame->stride(media::VideoFrame::kVPlane), | 158 new_frame->stride(media::VideoFrame::kVPlane), |
159 width, | 159 width, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( | 228 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( |
229 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), | 229 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), |
230 track_enabled)); | 230 track_enabled)); |
231 | 231 |
232 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); | 232 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); |
233 return true; | 233 return true; |
234 } | 234 } |
235 | 235 |
236 } // namespace content | 236 } // namespace content |
OLD | NEW |