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

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

Issue 2466353003: Replace all use of cricket::VideoFrame and cricket::WebRtcVideoFrame with webrtc::VideoFrame. (Closed)
Patch Set: Drop unneeded include. Created 4 years, 1 month 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/webrtc_video_renderer_adapter.h ('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_runner_util.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" 18 #include "base/threading/worker_pool.h"
19 #include "remoting/protocol/client_video_stats_dispatcher.h" 19 #include "remoting/protocol/client_video_stats_dispatcher.h"
20 #include "remoting/protocol/frame_consumer.h" 20 #include "remoting/protocol/frame_consumer.h"
21 #include "remoting/protocol/frame_stats.h" 21 #include "remoting/protocol/frame_stats.h"
22 #include "remoting/protocol/video_renderer.h" 22 #include "remoting/protocol/video_renderer.h"
23 #include "remoting/protocol/webrtc_transport.h" 23 #include "remoting/protocol/webrtc_transport.h"
24 #include "third_party/libyuv/include/libyuv/convert_from.h" 24 #include "third_party/libyuv/include/libyuv/convert_from.h"
25 #include "third_party/webrtc/media/base/videoframe.h"
26 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 25 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
27 26
28 namespace remoting { 27 namespace remoting {
29 namespace protocol { 28 namespace protocol {
30 29
31 namespace { 30 namespace {
32 31
33 // Maximum number of ClientFrameStats instances to keep. 32 // Maximum number of ClientFrameStats instances to keep.
34 const int kMaxQueuedStats = 200; 33 const int kMaxQueuedStats = 200;
35 34
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 video_tracks[0]->AddOrUpdateSink(this, rtc::VideoSinkWants()); 88 video_tracks[0]->AddOrUpdateSink(this, rtc::VideoSinkWants());
90 } 89 }
91 90
92 void WebrtcVideoRendererAdapter::SetVideoStatsChannel( 91 void WebrtcVideoRendererAdapter::SetVideoStatsChannel(
93 std::unique_ptr<MessagePipe> message_pipe) { 92 std::unique_ptr<MessagePipe> message_pipe) {
94 // Expect that the host also creates video_stats data channel. 93 // Expect that the host also creates video_stats data channel.
95 video_stats_dispatcher_.reset(new ClientVideoStatsDispatcher(label_, this)); 94 video_stats_dispatcher_.reset(new ClientVideoStatsDispatcher(label_, this));
96 video_stats_dispatcher_->Init(std::move(message_pipe), this); 95 video_stats_dispatcher_->Init(std::move(message_pipe), this);
97 } 96 }
98 97
99 void WebrtcVideoRendererAdapter::OnFrame(const cricket::VideoFrame& frame) { 98 void WebrtcVideoRendererAdapter::OnFrame(const webrtc::VideoFrame& frame) {
100 if (static_cast<uint64_t>(frame.timestamp_us()) >= rtc::TimeMicros()) { 99 if (static_cast<uint64_t>(frame.timestamp_us()) >= rtc::TimeMicros()) {
101 // The host sets playout delay to 0, so all incoming frames are expected to 100 // The host sets playout delay to 0, so all incoming frames are expected to
102 // be rendered as so as they are received. 101 // be rendered as so as they are received.
103 LOG(WARNING) << "Received frame with playout delay greater than 0."; 102 LOG(WARNING) << "Received frame with playout delay greater than 0.";
104 } 103 }
105 104
106 task_runner_->PostTask( 105 task_runner_->PostTask(
107 FROM_HERE, 106 FROM_HERE,
108 base::Bind(&WebrtcVideoRendererAdapter::HandleFrameOnMainThread, 107 base::Bind(&WebrtcVideoRendererAdapter::HandleFrameOnMainThread,
109 weak_factory_.GetWeakPtr(), frame.transport_frame_id(), 108 weak_factory_.GetWeakPtr(), frame.transport_frame_id(),
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 frame_stats.client_stats = *client_stats; 239 frame_stats.client_stats = *client_stats;
241 host_stats_queue_.pop_front(); 240 host_stats_queue_.pop_front();
242 FrameStatsConsumer* frame_stats_consumer = 241 FrameStatsConsumer* frame_stats_consumer =
243 video_renderer_->GetFrameStatsConsumer(); 242 video_renderer_->GetFrameStatsConsumer();
244 if (frame_stats_consumer) 243 if (frame_stats_consumer)
245 frame_stats_consumer->OnVideoFrameStats(frame_stats); 244 frame_stats_consumer->OnVideoFrameStats(frame_stats);
246 } 245 }
247 246
248 } // namespace protocol 247 } // namespace protocol
249 } // namespace remoting 248 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/webrtc_video_renderer_adapter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698