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

Side by Side Diff: remoting/protocol/webrtc_video_renderer_adapter.cc

Issue 2968663002: Update WebrtcVideoRendererAdapter to new buffer interface (Closed)
Patch Set: Created 3 years, 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "remoting/protocol/webrtc_video_renderer_adapter.h" 5 #include "remoting/protocol/webrtc_video_renderer_adapter.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 22 matching lines...) Expand all
33 33
34 std::unique_ptr<webrtc::DesktopFrame> ConvertYuvToRgb( 34 std::unique_ptr<webrtc::DesktopFrame> ConvertYuvToRgb(
35 scoped_refptr<webrtc::VideoFrameBuffer> yuv_frame, 35 scoped_refptr<webrtc::VideoFrameBuffer> yuv_frame,
36 std::unique_ptr<webrtc::DesktopFrame> rgb_frame, 36 std::unique_ptr<webrtc::DesktopFrame> rgb_frame,
37 FrameConsumer::PixelFormat pixel_format) { 37 FrameConsumer::PixelFormat pixel_format) {
38 DCHECK(rgb_frame->size().equals( 38 DCHECK(rgb_frame->size().equals(
39 webrtc::DesktopSize(yuv_frame->width(), yuv_frame->height()))); 39 webrtc::DesktopSize(yuv_frame->width(), yuv_frame->height())));
40 auto yuv_to_rgb_function = (pixel_format == FrameConsumer::FORMAT_BGRA) 40 auto yuv_to_rgb_function = (pixel_format == FrameConsumer::FORMAT_BGRA)
41 ? &libyuv::I420ToARGB 41 ? &libyuv::I420ToARGB
42 : &libyuv::I420ToABGR; 42 : &libyuv::I420ToABGR;
43 yuv_to_rgb_function(yuv_frame->DataY(), yuv_frame->StrideY(), 43 rtc::scoped_refptr<const webrtc::I420BufferInterface> i420_frame =
44 yuv_frame->DataU(), yuv_frame->StrideU(), 44 yuv_frame->ToI420();
45 yuv_frame->DataV(), yuv_frame->StrideV(), 45 yuv_to_rgb_function(i420_frame->DataY(), i420_frame->StrideY(),
46 i420_frame->DataU(), i420_frame->StrideU(),
47 i420_frame->DataV(), i420_frame->StrideV(),
46 rgb_frame->data(), rgb_frame->stride(), 48 rgb_frame->data(), rgb_frame->stride(),
47 yuv_frame->width(), yuv_frame->height()); 49 i420_frame->width(), i420_frame->height());
48 50
49 rgb_frame->mutable_updated_region()->AddRect( 51 rgb_frame->mutable_updated_region()->AddRect(
50 webrtc::DesktopRect::MakeSize(rgb_frame->size())); 52 webrtc::DesktopRect::MakeSize(rgb_frame->size()));
51 return rgb_frame; 53 return rgb_frame;
52 } 54 }
53 55
54 } // namespace 56 } // namespace
55 57
56 WebrtcVideoRendererAdapter::WebrtcVideoRendererAdapter( 58 WebrtcVideoRendererAdapter::WebrtcVideoRendererAdapter(
57 const std::string& label, 59 const std::string& label,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 frame_stats.client_stats = *client_stats; 240 frame_stats.client_stats = *client_stats;
239 host_stats_queue_.pop_front(); 241 host_stats_queue_.pop_front();
240 FrameStatsConsumer* frame_stats_consumer = 242 FrameStatsConsumer* frame_stats_consumer =
241 video_renderer_->GetFrameStatsConsumer(); 243 video_renderer_->GetFrameStatsConsumer();
242 if (frame_stats_consumer) 244 if (frame_stats_consumer)
243 frame_stats_consumer->OnVideoFrameStats(frame_stats); 245 frame_stats_consumer->OnVideoFrameStats(frame_stats);
244 } 246 }
245 247
246 } // namespace protocol 248 } // namespace protocol
247 } // namespace remoting 249 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698