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

Side by Side Diff: content/renderer/media/video_track_recorder.cc

Issue 1737253002: Handle Alpha channel in Canvas capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/video_track_recorder.h" 5 #include "content/renderer/media/video_track_recorder.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 this, frame, capture_timestamp)); 185 this, frame, capture_timestamp));
186 } 186 }
187 187
188 void VideoTrackRecorder::VpxEncoder::EncodeOnEncodingThread( 188 void VideoTrackRecorder::VpxEncoder::EncodeOnEncodingThread(
189 const scoped_refptr<VideoFrame>& frame, 189 const scoped_refptr<VideoFrame>& frame,
190 base::TimeTicks capture_timestamp) { 190 base::TimeTicks capture_timestamp) {
191 TRACE_EVENT0("video", 191 TRACE_EVENT0("video",
192 "VideoTrackRecorder::VpxEncoder::EncodeOnEncodingThread"); 192 "VideoTrackRecorder::VpxEncoder::EncodeOnEncodingThread");
193 DCHECK(encoding_thread_->task_runner()->BelongsToCurrentThread()); 193 DCHECK(encoding_thread_->task_runner()->BelongsToCurrentThread());
194 194
195 if (!(frame->IsMappable() &&
mcasas 2016/02/25 22:06:25 Why add this here now? (Same elsewhere).
emircan 2016/02/26 01:33:08 Removing IsMappable() checks.
196 (frame->format() == media::PIXEL_FORMAT_I420 ||
197 frame->format() == media::PIXEL_FORMAT_YV12A))) {
198 NOTREACHED();
199 return;
200 }
mcasas 2016/02/25 22:06:25 Judgment call: turn this into a DCHECK() and let i
emircan 2016/02/26 01:33:08 I actually started with DCHECKs but then found [0]
201
202 // Drop alpha channel since we do not support it yet.
203 if (frame->format() == media::PIXEL_FORMAT_YV12A)
204 frame->DropYV12AAlphaChannel();
205
195 const gfx::Size frame_size = frame->visible_rect().size(); 206 const gfx::Size frame_size = frame->visible_rect().size();
196 if (!IsInitialized() || 207 if (!IsInitialized() ||
197 gfx::Size(codec_config_.g_w, codec_config_.g_h) != frame_size) { 208 gfx::Size(codec_config_.g_w, codec_config_.g_h) != frame_size) {
198 ConfigureEncoding(frame_size); 209 ConfigureEncoding(frame_size);
199 } 210 }
200 211
201 vpx_image_t vpx_image; 212 vpx_image_t vpx_image;
202 vpx_image_t* const result = vpx_img_wrap(&vpx_image, 213 vpx_image_t* const result = vpx_img_wrap(&vpx_image,
203 VPX_IMG_FMT_I420, 214 VPX_IMG_FMT_I420,
204 frame_size.width(), 215 frame_size.width(),
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 encoder_->set_paused(false); 405 encoder_->set_paused(false);
395 } 406 }
396 407
397 void VideoTrackRecorder::OnVideoFrameForTesting( 408 void VideoTrackRecorder::OnVideoFrameForTesting(
398 const scoped_refptr<media::VideoFrame>& frame, 409 const scoped_refptr<media::VideoFrame>& frame,
399 base::TimeTicks timestamp) { 410 base::TimeTicks timestamp) {
400 encoder_->StartFrameEncode(frame, timestamp); 411 encoder_->StartFrameEncode(frame, timestamp);
401 } 412 }
402 413
403 } // namespace content 414 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698