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

Side by Side Diff: content/renderer/pepper/pepper_video_source_host.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 (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/pepper/pepper_video_source_host.h" 5 #include "content/renderer/pepper/pepper_video_source_host.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const base::WeakPtr<PepperVideoSourceHost>& host) 52 const base::WeakPtr<PepperVideoSourceHost>& host)
53 : host_(host) {} 53 : host_(host) {}
54 54
55 PepperVideoSourceHost::FrameReceiver::~FrameReceiver() {} 55 PepperVideoSourceHost::FrameReceiver::~FrameReceiver() {}
56 56
57 void PepperVideoSourceHost::FrameReceiver::GotFrame( 57 void PepperVideoSourceHost::FrameReceiver::GotFrame(
58 const scoped_refptr<media::VideoFrame>& frame) { 58 const scoped_refptr<media::VideoFrame>& frame) {
59 DCHECK(thread_checker_.CalledOnValidThread()); 59 DCHECK(thread_checker_.CalledOnValidThread());
60 if (!host_) 60 if (!host_)
61 return; 61 return;
62
63 if (!(frame->IsMappable() &&
64 (frame->format() == media::PIXEL_FORMAT_I420 ||
65 frame->format() == media::PIXEL_FORMAT_YV12A))) {
66 NOTREACHED();
67 return;
68 }
69
70 // Drop alpha channel since we do not support it yet.
71 if (frame->format() == media::PIXEL_FORMAT_YV12A)
72 frame->DropYV12AAlphaChannel();
73
62 // Hold a reference to the new frame and release the previous. 74 // Hold a reference to the new frame and release the previous.
63 host_->last_frame_ = frame; 75 host_->last_frame_ = frame;
64 if (host_->get_frame_pending_) 76 if (host_->get_frame_pending_)
65 host_->SendGetFrameReply(); 77 host_->SendGetFrameReply();
66 } 78 }
67 79
68 PepperVideoSourceHost::PepperVideoSourceHost(RendererPpapiHost* host, 80 PepperVideoSourceHost::PepperVideoSourceHost(RendererPpapiHost* host,
69 PP_Instance instance, 81 PP_Instance instance,
70 PP_Resource resource) 82 PP_Resource resource)
71 : ResourceHost(host->GetPpapiHost(), instance, resource), 83 : ResourceHost(host->GetPpapiHost(), instance, resource),
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 if (frame_source_.get() && !stream_url_.empty()) 314 if (frame_source_.get() && !stream_url_.empty())
303 frame_source_->Close(frame_receiver_.get()); 315 frame_source_->Close(frame_receiver_.get());
304 316
305 frame_source_.reset(NULL); 317 frame_source_.reset(NULL);
306 stream_url_.clear(); 318 stream_url_.clear();
307 319
308 shared_image_ = NULL; 320 shared_image_ = NULL;
309 } 321 }
310 322
311 } // namespace content 323 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698