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

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

Issue 1882583004: Updates for ongoing webrtc VideoFrame refactoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « content/renderer/media/webrtc/media_stream_remote_video_source.cc ('k') | 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 <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 DCHECK(task_runner_->BelongsToCurrentThread()); 48 DCHECK(task_runner_->BelongsToCurrentThread());
49 } 49 }
50 50
51 void WebrtcVideoRendererAdapter::OnFrame(const cricket::VideoFrame& frame) { 51 void WebrtcVideoRendererAdapter::OnFrame(const cricket::VideoFrame& frame) {
52 // TODO(sergeyu): WebRTC calls OnFrame on a separate thread it creates. 52 // TODO(sergeyu): WebRTC calls OnFrame on a separate thread it creates.
53 // FrameConsumer normally expects to be called on the network thread, so we 53 // FrameConsumer normally expects to be called on the network thread, so we
54 // cannot call FrameConsumer::AllocateFrame() here and instead 54 // cannot call FrameConsumer::AllocateFrame() here and instead
55 // BasicDesktopFrame is created directly. This will not work correctly with 55 // BasicDesktopFrame is created directly. This will not work correctly with
56 // all FrameConsumer implementations. Fix this somehow. 56 // all FrameConsumer implementations. Fix this somehow.
57 std::unique_ptr<webrtc::DesktopFrame> rgb_frame(new webrtc::BasicDesktopFrame( 57 std::unique_ptr<webrtc::DesktopFrame> rgb_frame(new webrtc::BasicDesktopFrame(
58 webrtc::DesktopSize(frame.GetWidth(), frame.GetHeight()))); 58 webrtc::DesktopSize(frame.width(), frame.height())));
59 59
60 frame.ConvertToRgbBuffer( 60 frame.ConvertToRgbBuffer(
61 output_format_fourcc_, rgb_frame->data(), 61 output_format_fourcc_, rgb_frame->data(),
62 std::abs(rgb_frame->stride()) * rgb_frame->size().height(), 62 std::abs(rgb_frame->stride()) * rgb_frame->size().height(),
63 rgb_frame->stride()); 63 rgb_frame->stride());
64 rgb_frame->mutable_updated_region()->AddRect( 64 rgb_frame->mutable_updated_region()->AddRect(
65 webrtc::DesktopRect::MakeSize(rgb_frame->size())); 65 webrtc::DesktopRect::MakeSize(rgb_frame->size()));
66 task_runner_->PostTask( 66 task_runner_->PostTask(
67 FROM_HERE, 67 FROM_HERE,
68 base::Bind(&WebrtcVideoRendererAdapter::DrawFrame, 68 base::Bind(&WebrtcVideoRendererAdapter::DrawFrame,
69 weak_factory_.GetWeakPtr(), base::Passed(&rgb_frame))); 69 weak_factory_.GetWeakPtr(), base::Passed(&rgb_frame)));
70 } 70 }
71 71
72 void WebrtcVideoRendererAdapter::DrawFrame( 72 void WebrtcVideoRendererAdapter::DrawFrame(
73 std::unique_ptr<webrtc::DesktopFrame> frame) { 73 std::unique_ptr<webrtc::DesktopFrame> frame) {
74 DCHECK(task_runner_->BelongsToCurrentThread()); 74 DCHECK(task_runner_->BelongsToCurrentThread());
75 frame_consumer_->DrawFrame(std::move(frame), base::Closure()); 75 frame_consumer_->DrawFrame(std::move(frame), base::Closure());
76 } 76 }
77 77
78 } // namespace remoting 78 } // namespace remoting
79 } // namespace protocol 79 } // namespace protocol
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc/media_stream_remote_video_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698