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

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

Issue 2610493002: Use TaskScheduler instead of WorkerPool in webrtc_video_renderer_adapter.cc. (Closed)
Patch Set: rebase Created 3 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
« no previous file with comments | « remoting/protocol/connection_unittest.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 <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/task_runner_util.h" 16 #include "base/task_scheduler/post_task.h"
17 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
18 #include "base/threading/worker_pool.h"
19 #include "remoting/protocol/client_video_stats_dispatcher.h" 18 #include "remoting/protocol/client_video_stats_dispatcher.h"
20 #include "remoting/protocol/frame_consumer.h" 19 #include "remoting/protocol/frame_consumer.h"
21 #include "remoting/protocol/frame_stats.h" 20 #include "remoting/protocol/frame_stats.h"
22 #include "remoting/protocol/video_renderer.h" 21 #include "remoting/protocol/video_renderer.h"
23 #include "remoting/protocol/webrtc_transport.h" 22 #include "remoting/protocol/webrtc_transport.h"
24 #include "third_party/libyuv/include/libyuv/convert_from.h" 23 #include "third_party/libyuv/include/libyuv/convert_from.h"
25 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 24 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
26 25
27 namespace remoting { 26 namespace remoting {
28 namespace protocol { 27 namespace protocol {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 167
169 std::unique_ptr<ClientFrameStats> stats(new ClientFrameStats()); 168 std::unique_ptr<ClientFrameStats> stats(new ClientFrameStats());
170 // TODO(sergeyu): |time_received| is not reported correctly here because the 169 // TODO(sergeyu): |time_received| is not reported correctly here because the
171 // frame is already decoded at this point. 170 // frame is already decoded at this point.
172 stats->time_received = time_received; 171 stats->time_received = time_received;
173 172
174 std::unique_ptr<webrtc::DesktopFrame> rgb_frame = 173 std::unique_ptr<webrtc::DesktopFrame> rgb_frame =
175 video_renderer_->GetFrameConsumer()->AllocateFrame( 174 video_renderer_->GetFrameConsumer()->AllocateFrame(
176 webrtc::DesktopSize(frame->width(), frame->height())); 175 webrtc::DesktopSize(frame->width(), frame->height()));
177 176
178 base::PostTaskAndReplyWithResult( 177 base::PostTaskWithTraitsAndReplyWithResult(
179 base::WorkerPool::GetTaskRunner(false).get(), FROM_HERE, 178 FROM_HERE, base::TaskTraits().WithShutdownBehavior(
179 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
180 base::Bind(&ConvertYuvToRgb, base::Passed(&frame), 180 base::Bind(&ConvertYuvToRgb, base::Passed(&frame),
181 base::Passed(&rgb_frame), 181 base::Passed(&rgb_frame),
182 video_renderer_->GetFrameConsumer()->GetPixelFormat()), 182 video_renderer_->GetFrameConsumer()->GetPixelFormat()),
183 base::Bind(&WebrtcVideoRendererAdapter::DrawFrame, 183 base::Bind(&WebrtcVideoRendererAdapter::DrawFrame,
184 weak_factory_.GetWeakPtr(), frame_id, base::Passed(&stats))); 184 weak_factory_.GetWeakPtr(), frame_id, base::Passed(&stats)));
185 } 185 }
186 186
187 void WebrtcVideoRendererAdapter::DrawFrame( 187 void WebrtcVideoRendererAdapter::DrawFrame(
188 uint32_t frame_id, 188 uint32_t frame_id,
189 std::unique_ptr<ClientFrameStats> stats, 189 std::unique_ptr<ClientFrameStats> stats,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 frame_stats.client_stats = *client_stats; 239 frame_stats.client_stats = *client_stats;
240 host_stats_queue_.pop_front(); 240 host_stats_queue_.pop_front();
241 FrameStatsConsumer* frame_stats_consumer = 241 FrameStatsConsumer* frame_stats_consumer =
242 video_renderer_->GetFrameStatsConsumer(); 242 video_renderer_->GetFrameStatsConsumer();
243 if (frame_stats_consumer) 243 if (frame_stats_consumer)
244 frame_stats_consumer->OnVideoFrameStats(frame_stats); 244 frame_stats_consumer->OnVideoFrameStats(frame_stats);
245 } 245 }
246 246
247 } // namespace protocol 247 } // namespace protocol
248 } // namespace remoting 248 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698