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

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

Issue 936553003: Fix VideoFramePump to send keep-alive packets only after the first real frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 VideoFramePump::VideoFramePump( 54 VideoFramePump::VideoFramePump(
55 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner, 55 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
56 scoped_ptr<webrtc::DesktopCapturer> capturer, 56 scoped_ptr<webrtc::DesktopCapturer> capturer,
57 scoped_ptr<VideoEncoder> encoder, 57 scoped_ptr<VideoEncoder> encoder,
58 protocol::VideoStub* video_stub) 58 protocol::VideoStub* video_stub)
59 : encode_task_runner_(encode_task_runner), 59 : encode_task_runner_(encode_task_runner),
60 capturer_(capturer.Pass()), 60 capturer_(capturer.Pass()),
61 encoder_(encoder.Pass()), 61 encoder_(encoder.Pass()),
62 video_stub_(video_stub), 62 video_stub_(video_stub),
63 keep_alive_timer_(true, true), 63 keep_alive_timer_(
64 FROM_HERE,
65 base::TimeDelta::FromMilliseconds(kKeepAlivePacketIntervalMs),
66 base::Bind(&VideoFramePump::SendKeepAlivePacket,
67 base::Unretained(this)),
68 false),
Wez 2015/02/18 22:59:35 You've changed this from repeating to non-repeatin
Sergey Ulanov 2015/02/18 23:31:41 Yes - it's mentioned in the CL description. It's n
64 capture_scheduler_(base::Bind(&VideoFramePump::CaptureNextFrame, 69 capture_scheduler_(base::Bind(&VideoFramePump::CaptureNextFrame,
65 base::Unretained(this))), 70 base::Unretained(this))),
66 latest_event_timestamp_(0), 71 latest_event_timestamp_(0),
67 weak_factory_(this) { 72 weak_factory_(this) {
68 DCHECK(encoder_); 73 DCHECK(encoder_);
69 DCHECK(video_stub_); 74 DCHECK(video_stub_);
70 75
71 capturer_->Start(this); 76 capturer_->Start(this);
72 capture_scheduler_.Start(); 77 capture_scheduler_.Start();
73
74 keep_alive_timer_.Start(
75 FROM_HERE, base::TimeDelta::FromMilliseconds(kKeepAlivePacketIntervalMs),
76 base::Bind(&VideoFramePump::SendKeepAlivePacket, base::Unretained(this)));
77 } 78 }
78 79
79 VideoFramePump::~VideoFramePump() { 80 VideoFramePump::~VideoFramePump() {
80 encode_task_runner_->DeleteSoon(FROM_HERE, encoder_.release()); 81 encode_task_runner_->DeleteSoon(FROM_HERE, encoder_.release());
81 } 82 }
82 83
83 void VideoFramePump::Pause(bool pause) { 84 void VideoFramePump::Pause(bool pause) {
84 DCHECK(thread_checker_.CalledOnValidThread()); 85 DCHECK(thread_checker_.CalledOnValidThread());
85 86
86 capture_scheduler_.Pause(pause); 87 capture_scheduler_.Pause(pause);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 weak_factory_.GetWeakPtr())); 170 weak_factory_.GetWeakPtr()));
170 } 171 }
171 172
172 void VideoFramePump::OnKeepAlivePacketSent() { 173 void VideoFramePump::OnKeepAlivePacketSent() {
173 DCHECK(thread_checker_.CalledOnValidThread()); 174 DCHECK(thread_checker_.CalledOnValidThread());
174 175
175 keep_alive_timer_.Reset(); 176 keep_alive_timer_.Reset();
176 } 177 }
177 178
178 } // namespace remoting 179 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/client_session_unittest.cc ('k') | tools/valgrind/gtest_exclude/remoting_unittests.gtest.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698