OLD | NEW |
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_source.h" | 14 #include "content/renderer/media/media_stream_video_source.h" |
15 #include "content/renderer/media/media_stream_video_track.h" | 15 #include "content/renderer/media/media_stream_video_track.h" |
16 #include "media/base/bind_to_current_loop.h" | 16 #include "media/base/bind_to_current_loop.h" |
17 #include "media/base/video_util.h" | 17 #include "media/base/video_util.h" |
18 #include "media/base/yuv_convert.h" | |
19 #include "ppapi/c/pp_errors.h" | 18 #include "ppapi/c/pp_errors.h" |
20 #include "ppapi/c/ppb_media_stream_video_track.h" | 19 #include "ppapi/c/ppb_media_stream_video_track.h" |
21 #include "ppapi/c/ppb_video_frame.h" | 20 #include "ppapi/c/ppb_video_frame.h" |
22 #include "ppapi/host/dispatch_host_message.h" | 21 #include "ppapi/host/dispatch_host_message.h" |
23 #include "ppapi/host/host_message_context.h" | 22 #include "ppapi/host/host_message_context.h" |
24 #include "ppapi/proxy/ppapi_messages.h" | 23 #include "ppapi/proxy/ppapi_messages.h" |
25 #include "ppapi/shared_impl/media_stream_buffer.h" | 24 #include "ppapi/shared_impl/media_stream_buffer.h" |
26 #include "third_party/libyuv/include/libyuv.h" | 25 #include "third_party/libyuv/include/libyuv.h" |
27 | 26 |
28 using media::VideoFrame; | 27 using media::VideoFrame; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 src->stride(VideoFrame::kYPlane), | 102 src->stride(VideoFrame::kYPlane), |
104 src->visible_data(VideoFrame::kUPlane), | 103 src->visible_data(VideoFrame::kUPlane), |
105 src->stride(VideoFrame::kUPlane), | 104 src->stride(VideoFrame::kUPlane), |
106 src->visible_data(VideoFrame::kVPlane), | 105 src->visible_data(VideoFrame::kVPlane), |
107 src->stride(VideoFrame::kVPlane), | 106 src->stride(VideoFrame::kVPlane), |
108 dst, | 107 dst, |
109 dst_size.width() * 4, | 108 dst_size.width() * 4, |
110 dst_size.width(), | 109 dst_size.width(), |
111 dst_size.height()); | 110 dst_size.height()); |
112 } else { | 111 } else { |
113 media::ScaleYUVToRGB32(src->visible_data(VideoFrame::kYPlane), | 112 libyuv::YUVToARGBScaleClip( |
114 src->visible_data(VideoFrame::kUPlane), | 113 src->visible_data(VideoFrame::kYPlane), |
115 src->visible_data(VideoFrame::kVPlane), | 114 src->stride(VideoFrame::kYPlane), |
116 dst, | 115 src->visible_data(VideoFrame::kUPlane), |
117 src->visible_rect().width(), | 116 src->stride(VideoFrame::kUPlane), |
118 src->visible_rect().height(), | 117 src->visible_data(VideoFrame::kVPlane), |
119 dst_size.width(), | 118 src->stride(VideoFrame::kVPlane), libyuv::FOURCC_YV12, |
120 dst_size.height(), | 119 src->visible_rect().width(), src->visible_rect().height(), dst, |
121 src->stride(VideoFrame::kYPlane), | 120 dst_size.width() * 4, libyuv::FOURCC_ARGB, dst_size.width(), |
122 src->stride(VideoFrame::kUPlane), | 121 dst_size.height(), 0, 0, dst_size.width(), dst_size.height(), |
123 dst_size.width() * 4, | 122 kFilterMode); |
124 media::YV12, | |
125 media::ROTATE_0, | |
126 media::FILTER_BILINEAR); | |
127 } | 123 } |
128 } else if (dst_format == PP_VIDEOFRAME_FORMAT_YV12 || | 124 } else if (dst_format == PP_VIDEOFRAME_FORMAT_YV12 || |
129 dst_format == PP_VIDEOFRAME_FORMAT_I420) { | 125 dst_format == PP_VIDEOFRAME_FORMAT_I420) { |
130 static const size_t kPlanesOrder[][3] = { | 126 static const size_t kPlanesOrder[][3] = { |
131 {VideoFrame::kYPlane, VideoFrame::kVPlane, | 127 {VideoFrame::kYPlane, VideoFrame::kVPlane, |
132 VideoFrame::kUPlane}, // YV12 | 128 VideoFrame::kUPlane}, // YV12 |
133 {VideoFrame::kYPlane, VideoFrame::kUPlane, | 129 {VideoFrame::kYPlane, VideoFrame::kUPlane, |
134 VideoFrame::kVPlane}, // I420 | 130 VideoFrame::kVPlane}, // I420 |
135 }; | 131 }; |
136 const int plane_order = (dst_format == PP_VIDEOFRAME_FORMAT_YV12) ? 0 : 1; | 132 const int plane_order = (dst_format == PP_VIDEOFRAME_FORMAT_YV12) ? 0 : 1; |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 } | 535 } |
540 | 536 |
541 void PepperMediaStreamVideoTrackHost::OnTrackStarted( | 537 void PepperMediaStreamVideoTrackHost::OnTrackStarted( |
542 MediaStreamSource* source, | 538 MediaStreamSource* source, |
543 MediaStreamRequestResult result, | 539 MediaStreamRequestResult result, |
544 const blink::WebString& result_name) { | 540 const blink::WebString& result_name) { |
545 DVLOG(3) << "OnTrackStarted result: " << result; | 541 DVLOG(3) << "OnTrackStarted result: " << result; |
546 } | 542 } |
547 | 543 |
548 } // namespace content | 544 } // namespace content |
OLD | NEW |