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

Side by Side Diff: media/cast/video_sender/video_sender.cc

Issue 70713002: Cast: Restructure RTCP interface to better fit our usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing line lost in merge Created 7 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 | « media/cast/video_sender/video_sender.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/cast/video_sender/video_sender.h" 5 #include "media/cast/video_sender/video_sender.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 private: 47 private:
48 RtpSender* rtp_sender_; 48 RtpSender* rtp_sender_;
49 }; 49 };
50 50
51 VideoSender::VideoSender( 51 VideoSender::VideoSender(
52 scoped_refptr<CastEnvironment> cast_environment, 52 scoped_refptr<CastEnvironment> cast_environment,
53 const VideoSenderConfig& video_config, 53 const VideoSenderConfig& video_config,
54 VideoEncoderController* const video_encoder_controller, 54 VideoEncoderController* const video_encoder_controller,
55 PacedPacketSender* const paced_packet_sender) 55 PacedPacketSender* const paced_packet_sender)
56 : incoming_feedback_ssrc_(video_config.incoming_feedback_ssrc), 56 : rtp_max_delay_(
57 rtp_max_delay_(
58 base::TimeDelta::FromMilliseconds(video_config.rtp_max_delay_ms)), 57 base::TimeDelta::FromMilliseconds(video_config.rtp_max_delay_ms)),
59 max_frame_rate_(video_config.max_frame_rate), 58 max_frame_rate_(video_config.max_frame_rate),
60 cast_environment_(cast_environment), 59 cast_environment_(cast_environment),
61 rtcp_feedback_(new LocalRtcpVideoSenderFeedback(this)), 60 rtcp_feedback_(new LocalRtcpVideoSenderFeedback(this)),
62 rtp_sender_(new RtpSender(cast_environment->Clock(), NULL, &video_config, 61 rtp_sender_(new RtpSender(cast_environment->Clock(), NULL, &video_config,
63 paced_packet_sender)), 62 paced_packet_sender)),
64 last_acked_frame_id_(-1), 63 last_acked_frame_id_(-1),
65 last_sent_frame_id_(-1), 64 last_sent_frame_id_(-1),
66 duplicate_ack_(0), 65 duplicate_ack_(0),
67 last_skip_count_(0), 66 last_skip_count_(0),
(...skipping 21 matching lines...) Expand all
89 video_encoder_controller_ = video_encoder_.get(); 88 video_encoder_controller_ = video_encoder_.get();
90 } 89 }
91 rtcp_.reset(new Rtcp( 90 rtcp_.reset(new Rtcp(
92 cast_environment_->Clock(), 91 cast_environment_->Clock(),
93 rtcp_feedback_.get(), 92 rtcp_feedback_.get(),
94 paced_packet_sender, 93 paced_packet_sender,
95 rtp_video_sender_statistics_.get(), 94 rtp_video_sender_statistics_.get(),
96 NULL, 95 NULL,
97 video_config.rtcp_mode, 96 video_config.rtcp_mode,
98 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval), 97 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval),
99 true,
100 video_config.sender_ssrc, 98 video_config.sender_ssrc,
99 video_config.incoming_feedback_ssrc,
101 video_config.rtcp_c_name)); 100 video_config.rtcp_c_name));
102
103 rtcp_->SetRemoteSSRC(video_config.incoming_feedback_ssrc);
104 } 101 }
105 102
106 VideoSender::~VideoSender() {} 103 VideoSender::~VideoSender() {}
107 104
108 void VideoSender::InitializeTimers() { 105 void VideoSender::InitializeTimers() {
109 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 106 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
110 if (!initialized_) { 107 if (!initialized_) {
111 initialized_ = true; 108 initialized_ = true;
112 ScheduleNextRtcpReport(); 109 ScheduleNextRtcpReport();
113 ScheduleNextResendCheck(); 110 ScheduleNextResendCheck();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 time_to_next = std::max(time_to_next, 172 time_to_next = std::max(time_to_next,
176 base::TimeDelta::FromMilliseconds(kMinSchedulingDelayMs)); 173 base::TimeDelta::FromMilliseconds(kMinSchedulingDelayMs));
177 174
178 cast_environment_->PostDelayedTask(CastEnvironment::MAIN, FROM_HERE, 175 cast_environment_->PostDelayedTask(CastEnvironment::MAIN, FROM_HERE,
179 base::Bind(&VideoSender::SendRtcpReport, weak_factory_.GetWeakPtr()), 176 base::Bind(&VideoSender::SendRtcpReport, weak_factory_.GetWeakPtr()),
180 time_to_next); 177 time_to_next);
181 } 178 }
182 179
183 void VideoSender::SendRtcpReport() { 180 void VideoSender::SendRtcpReport() {
184 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 181 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
185 rtcp_->SendRtcpReport(incoming_feedback_ssrc_); 182 rtcp_->SendRtcpFromRtpSender(NULL); // TODO(pwestin): add logging.
186 ScheduleNextRtcpReport(); 183 ScheduleNextRtcpReport();
187 } 184 }
188 185
189 void VideoSender::ScheduleNextResendCheck() { 186 void VideoSender::ScheduleNextResendCheck() {
190 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 187 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
191 base::TimeDelta time_to_next; 188 base::TimeDelta time_to_next;
192 if (last_send_time_.is_null()) { 189 if (last_send_time_.is_null()) {
193 time_to_next = rtp_max_delay_; 190 time_to_next = rtp_max_delay_;
194 } else { 191 } else {
195 time_to_next = last_send_time_ - cast_environment_->Clock()->NowTicks() + 192 time_to_next = last_send_time_ - cast_environment_->Clock()->NowTicks() +
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 346 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
350 MissingFramesAndPacketsMap missing_frames_and_packets; 347 MissingFramesAndPacketsMap missing_frames_and_packets;
351 PacketIdSet missing; 348 PacketIdSet missing;
352 missing_frames_and_packets.insert(std::make_pair(resend_frame_id, missing)); 349 missing_frames_and_packets.insert(std::make_pair(resend_frame_id, missing));
353 rtp_sender_->ResendPackets(missing_frames_and_packets); 350 rtp_sender_->ResendPackets(missing_frames_and_packets);
354 last_send_time_ = cast_environment_->Clock()->NowTicks(); 351 last_send_time_ = cast_environment_->Clock()->NowTicks();
355 } 352 }
356 353
357 } // namespace cast 354 } // namespace cast
358 } // namespace media 355 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/video_sender/video_sender.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698