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

Side by Side Diff: content/renderer/pepper/pepper_media_stream_video_track_host.cc

Issue 1737253002: Handle Alpha channel in Canvas capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_media_stream_video_track_host.h" 5 #include "content/renderer/pepper/pepper_media_stream_video_track_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "content/renderer/media/media_stream_video_track.h" 14 #include "content/renderer/media/media_stream_video_track.h"
15 #include "media/base/bind_to_current_loop.h" 15 #include "media/base/bind_to_current_loop.h"
16 #include "media/base/video_util.h"
16 #include "media/base/yuv_convert.h" 17 #include "media/base/yuv_convert.h"
17 #include "ppapi/c/pp_errors.h" 18 #include "ppapi/c/pp_errors.h"
18 #include "ppapi/c/ppb_media_stream_video_track.h" 19 #include "ppapi/c/ppb_media_stream_video_track.h"
19 #include "ppapi/c/ppb_video_frame.h" 20 #include "ppapi/c/ppb_video_frame.h"
20 #include "ppapi/host/dispatch_host_message.h" 21 #include "ppapi/host/dispatch_host_message.h"
21 #include "ppapi/host/host_message_context.h" 22 #include "ppapi/host/host_message_context.h"
22 #include "ppapi/proxy/ppapi_messages.h" 23 #include "ppapi/proxy/ppapi_messages.h"
23 #include "ppapi/shared_impl/media_stream_buffer.h" 24 #include "ppapi/shared_impl/media_stream_buffer.h"
24 #include "third_party/libyuv/include/libyuv.h" 25 #include "third_party/libyuv/include/libyuv.h"
25 26
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 364
364 frame_deliverer_->DeliverVideoFrame(frame); 365 frame_deliverer_->DeliverVideoFrame(frame);
365 } 366 }
366 367
367 // Makes the frame available again for plugin. 368 // Makes the frame available again for plugin.
368 SendEnqueueBufferMessageToPlugin(index); 369 SendEnqueueBufferMessageToPlugin(index);
369 return PP_OK; 370 return PP_OK;
370 } 371 }
371 372
372 void PepperMediaStreamVideoTrackHost::OnVideoFrame( 373 void PepperMediaStreamVideoTrackHost::OnVideoFrame(
373 const scoped_refptr<VideoFrame>& frame, 374 const scoped_refptr<VideoFrame>& video_frame,
374 base::TimeTicks estimated_capture_time) { 375 base::TimeTicks estimated_capture_time) {
375 DCHECK(frame.get()); 376 DCHECK(video_frame.get());
376 // TODO(penghuang): Check |frame->end_of_stream()| and close the track. 377 // TODO(penghuang): Check |frame->end_of_stream()| and close the track.
378 scoped_refptr<media::VideoFrame> frame = video_frame;
379 // Drop alpha channel since we do not support it yet.
380 if (frame->format() == media::PIXEL_FORMAT_YV12A)
381 frame = media::WrapAsI420VideoFrame(video_frame);
377 PP_VideoFrame_Format ppformat = ToPpapiFormat(frame->format()); 382 PP_VideoFrame_Format ppformat = ToPpapiFormat(frame->format());
383
bbudge 2016/03/08 13:17:33 nit: why add whitespace here?
emircan 2016/03/08 19:01:46 Removed
378 if (ppformat == PP_VIDEOFRAME_FORMAT_UNKNOWN) 384 if (ppformat == PP_VIDEOFRAME_FORMAT_UNKNOWN)
379 return; 385 return;
380 386
381 if (source_frame_size_.IsEmpty()) { 387 if (source_frame_size_.IsEmpty()) {
382 source_frame_size_ = frame->visible_rect().size(); 388 source_frame_size_ = frame->visible_rect().size();
383 source_frame_format_ = ppformat; 389 source_frame_format_ = ppformat;
384 InitBuffers(); 390 InitBuffers();
385 } 391 }
386 392
387 int32_t index = buffer_manager()->DequeueBuffer(); 393 int32_t index = buffer_manager()->DequeueBuffer();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 533 }
528 534
529 void PepperMediaStreamVideoTrackHost::OnTrackStarted( 535 void PepperMediaStreamVideoTrackHost::OnTrackStarted(
530 MediaStreamSource* source, 536 MediaStreamSource* source,
531 MediaStreamRequestResult result, 537 MediaStreamRequestResult result,
532 const blink::WebString& result_name) { 538 const blink::WebString& result_name) {
533 DVLOG(3) << "OnTrackStarted result: " << result; 539 DVLOG(3) << "OnTrackStarted result: " << result;
534 } 540 }
535 541
536 } // namespace content 542 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698