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

Side by Side Diff: remoting/host/video_frame_pump.cc

Issue 1150163002: Update VideoFramePump to pass un-changed frames to encoders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments Created 5 years, 7 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
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/host/video_frame_pump.h" 5 #include "remoting/host/video_frame_pump.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/task_runner_util.h" 14 #include "base/task_runner_util.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "remoting/proto/control.pb.h" 16 #include "remoting/proto/control.pb.h"
17 #include "remoting/proto/video.pb.h" 17 #include "remoting/proto/video.pb.h"
18 #include "remoting/protocol/video_stub.h" 18 #include "remoting/protocol/video_stub.h"
19 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 19 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
20 20
21 namespace remoting { 21 namespace remoting {
22 22
23 namespace { 23 namespace {
24 24
25 // Helper used to encode frames on the encode thread.
26 //
27 // TODO(sergeyu): This functions doesn't do much beside calling
28 // VideoEncoder::Encode(). It's only needed to handle empty frames properly and
29 // that logic can be moved to VideoEncoder implementations.
30 scoped_ptr<VideoPacket> EncodeFrame(VideoEncoder* encoder, 25 scoped_ptr<VideoPacket> EncodeFrame(VideoEncoder* encoder,
31 scoped_ptr<webrtc::DesktopFrame> frame) { 26 scoped_ptr<webrtc::DesktopFrame> frame) {
32 // If there is nothing to encode then send an empty packet. 27 scoped_ptr<VideoPacket> packet;
33 if (!frame || frame->updated_region().is_empty())
34 return make_scoped_ptr(new VideoPacket());
35 28
36 return encoder->Encode(*frame); 29 // If |frame| is non-NULL then let the encoder process it.
30 if (frame) {
31 packet = encoder->Encode(*frame);
32 }
33
34 // If |frame| is NULL, or the encoder returned nothing, return an empty
35 // packet.
36 if (!packet) {
37 packet.reset(new VideoPacket());
38 }
39
40 return packet.Pass();
37 } 41 }
38 42
39 } // namespace 43 } // namespace
40 44
41 // Interval between empty keep-alive frames. These frames are sent only when the 45 // Interval between empty keep-alive frames. These frames are sent only when the
42 // stream is paused or inactive for some other reason (e.g. when blocked on 46 // stream is paused or inactive for some other reason (e.g. when blocked on
43 // capturer). To prevent PseudoTCP from resetting congestion window this value 47 // capturer). To prevent PseudoTCP from resetting congestion window this value
44 // must be smaller than the minimum RTO used in PseudoTCP, which is 250ms. 48 // must be smaller than the minimum RTO used in PseudoTCP, which is 250ms.
45 static const int kKeepAlivePacketIntervalMs = 200; 49 static const int kKeepAlivePacketIntervalMs = 200;
46 50
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 weak_factory_.GetWeakPtr())); 173 weak_factory_.GetWeakPtr()));
170 } 174 }
171 175
172 void VideoFramePump::OnKeepAlivePacketSent() { 176 void VideoFramePump::OnKeepAlivePacketSent() {
173 DCHECK(thread_checker_.CalledOnValidThread()); 177 DCHECK(thread_checker_.CalledOnValidThread());
174 178
175 keep_alive_timer_.Reset(); 179 keep_alive_timer_.Reset();
176 } 180 }
177 181
178 } // namespace remoting 182 } // namespace remoting
OLDNEW
« remoting/codec/video_encoder_vpx.cc ('K') | « remoting/host/client_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698