Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: content/renderer/media/webrtc/video_destination_handler.cc

Issue 1006043002: Effects plugin: Chrome OS is ready for switching from BGRA to ARGB. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_video_source_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 =
148 frame_pool_.CreateFrame(media::VideoFrame::YV12, frame_size, 148 frame_pool_.CreateFrame(media::VideoFrame::YV12, frame_size,
149 gfx::Rect(frame_size), frame_size, timestamp); 149 gfx::Rect(frame_size), frame_size, timestamp);
150 150
151 // TODO(magjed): Chrome OS is not ready for switching from BGRA to ARGB. 151 libyuv::ARGBToI420(src_data,
152 // Remove this once http://crbug/434007 is fixed. We have a corresponding 152 src_stride,
153 // problem when we send frames to the effects plugin in PepperVideoSourceHost. 153 new_frame->data(media::VideoFrame::kYPlane),
154 #if defined(OS_CHROMEOS) 154 new_frame->stride(media::VideoFrame::kYPlane),
155 auto libyuv_xxxx_to_i420 = &libyuv::BGRAToI420; 155 new_frame->data(media::VideoFrame::kUPlane),
156 #else 156 new_frame->stride(media::VideoFrame::kUPlane),
157 auto libyuv_xxxx_to_i420 = &libyuv::ARGBToI420; 157 new_frame->data(media::VideoFrame::kVPlane),
158 #endif 158 new_frame->stride(media::VideoFrame::kVPlane),
159 libyuv_xxxx_to_i420(src_data, 159 width,
160 src_stride, 160 height);
161 new_frame->data(media::VideoFrame::kYPlane),
162 new_frame->stride(media::VideoFrame::kYPlane),
163 new_frame->data(media::VideoFrame::kUPlane),
164 new_frame->stride(media::VideoFrame::kUPlane),
165 new_frame->data(media::VideoFrame::kVPlane),
166 new_frame->stride(media::VideoFrame::kVPlane),
167 width,
168 height);
169 161
170 delegate_->DeliverFrame(new_frame); 162 delegate_->DeliverFrame(new_frame);
171 } 163 }
172 164
173 // PpFrameWriterProxy is a helper class to make sure the user won't use 165 // PpFrameWriterProxy is a helper class to make sure the user won't use
174 // PpFrameWriter after it is released (IOW its owner - WebMediaStreamSource - 166 // PpFrameWriter after it is released (IOW its owner - WebMediaStreamSource -
175 // is released). 167 // is released).
176 class PpFrameWriterProxy : public FrameWriterInterface { 168 class PpFrameWriterProxy : public FrameWriterInterface {
177 public: 169 public:
178 explicit PpFrameWriterProxy(const base::WeakPtr<PpFrameWriter>& writer) 170 explicit PpFrameWriterProxy(const base::WeakPtr<PpFrameWriter>& writer)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 227
236 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack( 228 stream.addTrack(MediaStreamVideoTrack::CreateVideoTrack(
237 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), 229 writer, constraints, MediaStreamVideoSource::ConstraintsCallback(),
238 track_enabled)); 230 track_enabled));
239 231
240 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); 232 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr());
241 return true; 233 return true;
242 } 234 }
243 235
244 } // namespace content 236 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_video_source_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698