| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 DCHECK(io_message_loop_->BelongsToCurrentThread()); | 134 DCHECK(io_message_loop_->BelongsToCurrentThread()); |
| 135 TRACE_EVENT0("video", "PpFrameWriter::FrameWriterDelegate::DeliverFrameOnIO"); | 135 TRACE_EVENT0("video", "PpFrameWriter::FrameWriterDelegate::DeliverFrameOnIO"); |
| 136 | 136 |
| 137 if (new_frame_callback_.is_null()) | 137 if (new_frame_callback_.is_null()) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 const gfx::Size frame_size(width, height); | 140 const gfx::Size frame_size(width, height); |
| 141 const base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds( | 141 const base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds( |
| 142 time_stamp_ns / base::Time::kNanosecondsPerMicrosecond); | 142 time_stamp_ns / base::Time::kNanosecondsPerMicrosecond); |
| 143 | 143 |
| 144 // TODO(perkj): It would be more efficient to use I420 here. Using YV12 will | |
| 145 // force a copy into a tightly packed I420 frame in | |
| 146 // WebRtcVideoCapturerAdapter before the frame is delivered to libJingle. | |
| 147 // crbug/359587. | |
| 148 scoped_refptr<media::VideoFrame> new_frame = | 144 scoped_refptr<media::VideoFrame> new_frame = |
| 149 frame_pool_.CreateFrame(media::VideoFrame::YV12, frame_size, | 145 frame_pool_.CreateFrame(media::VideoFrame::YV12, frame_size, |
| 150 gfx::Rect(frame_size), frame_size, timestamp); | 146 gfx::Rect(frame_size), frame_size, timestamp); |
| 151 media::VideoCaptureFormat format( | 147 media::VideoCaptureFormat format( |
| 152 frame_size, | 148 frame_size, |
| 153 MediaStreamVideoSource::kUnknownFrameRate, | 149 MediaStreamVideoSource::kUnknownFrameRate, |
| 154 media::PIXEL_FORMAT_YV12); | 150 media::PIXEL_FORMAT_YV12); |
| 155 | 151 |
| 156 libyuv::BGRAToI420(data, | 152 libyuv::BGRAToI420(data, |
| 157 stride, | 153 stride, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 bool track_enabled = true; | 249 bool track_enabled = true; |
| 254 | 250 |
| 255 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( | 251 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( |
| 256 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), | 252 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), |
| 257 track_enabled)); | 253 track_enabled)); |
| 258 | 254 |
| 259 return true; | 255 return true; |
| 260 } | 256 } |
| 261 | 257 |
| 262 } // namespace content | 258 } // namespace content |
| OLD | NEW |