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

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

Issue 229503002: Cast: Make castv2 mirroring performance test run again (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix a cast sender bug too Created 6 years, 8 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 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 <cstring> 7 #include <cstring>
8 #include <list> 8 #include <list>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 uint32 new_bitrate = 0; 400 uint32 new_bitrate = 0;
401 if (congestion_control_.OnNack(rtt, &new_bitrate)) { 401 if (congestion_control_.OnNack(rtt, &new_bitrate)) {
402 video_encoder_->SetBitRate(new_bitrate); 402 video_encoder_->SetBitRate(new_bitrate);
403 } 403 }
404 } 404 }
405 ReceivedAck(cast_feedback.ack_frame_id_); 405 ReceivedAck(cast_feedback.ack_frame_id_);
406 } 406 }
407 407
408 void VideoSender::ReceivedAck(uint32 acked_frame_id) { 408 void VideoSender::ReceivedAck(uint32 acked_frame_id) {
409 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 409 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
410 if (acked_frame_id == UINT32_C(0xFFFFFFFF)) {
411 // Receiver is sending a status message before any frames are ready to
412 // be acked. Ignore.
413 return;
414 }
410 // Start sending RTCP packets only after receiving the first ACK, i.e. only 415 // Start sending RTCP packets only after receiving the first ACK, i.e. only
411 // after establishing that the receiver is active. 416 // after establishing that the receiver is active.
412 if (last_acked_frame_id_ == -1) { 417 if (last_acked_frame_id_ == -1) {
413 ScheduleNextRtcpReport(); 418 ScheduleNextRtcpReport();
414 } 419 }
415 last_acked_frame_id_ = static_cast<int>(acked_frame_id); 420 last_acked_frame_id_ = static_cast<int>(acked_frame_id);
416 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); 421 base::TimeTicks now = cast_environment_->Clock()->NowTicks();
417 422
418 RtpTimestamp rtp_timestamp = 423 RtpTimestamp rtp_timestamp =
419 frame_id_to_rtp_timestamp_[acked_frame_id & 0xff]; 424 frame_id_to_rtp_timestamp_[acked_frame_id & 0xff];
420 cast_environment_->Logging()->InsertFrameEvent( 425 cast_environment_->Logging()->InsertFrameEvent(
421 now, kVideoAckReceived, rtp_timestamp, acked_frame_id); 426 now, kVideoAckReceived, rtp_timestamp, acked_frame_id);
422 427
423 VLOG(2) << "ReceivedAck:" << static_cast<int>(acked_frame_id); 428 VLOG(2) << "ReceivedAck:" << static_cast<int>(acked_frame_id);
424 last_acked_frame_id_ = acked_frame_id;
425 active_session_ = true; 429 active_session_ = true;
430 DCHECK_NE(-1, last_acked_frame_id_);
426 UpdateFramesInFlight(); 431 UpdateFramesInFlight();
427 } 432 }
428 433
429 void VideoSender::UpdateFramesInFlight() { 434 void VideoSender::UpdateFramesInFlight() {
430 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 435 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
431 if (last_sent_frame_id_ != -1) { 436 if (last_sent_frame_id_ != -1) {
432 DCHECK_LE(0, last_sent_frame_id_); 437 DCHECK_LE(0, last_sent_frame_id_);
433 uint32 frames_in_flight = 0; 438 uint32 frames_in_flight = 0;
434 if (last_acked_frame_id_ != -1) { 439 if (last_acked_frame_id_ != -1) {
435 DCHECK_LE(0, last_acked_frame_id_); 440 DCHECK_LE(0, last_acked_frame_id_);
(...skipping 18 matching lines...) Expand all
454 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 459 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
455 MissingFramesAndPacketsMap missing_frames_and_packets; 460 MissingFramesAndPacketsMap missing_frames_and_packets;
456 PacketIdSet missing; 461 PacketIdSet missing;
457 missing_frames_and_packets.insert(std::make_pair(resend_frame_id, missing)); 462 missing_frames_and_packets.insert(std::make_pair(resend_frame_id, missing));
458 last_send_time_ = cast_environment_->Clock()->NowTicks(); 463 last_send_time_ = cast_environment_->Clock()->NowTicks();
459 transport_sender_->ResendPackets(false, missing_frames_and_packets); 464 transport_sender_->ResendPackets(false, missing_frames_and_packets);
460 } 465 }
461 466
462 } // namespace cast 467 } // namespace cast
463 } // namespace media 468 } // namespace media
OLDNEW
« media/cast/video_receiver/video_receiver.cc ('K') | « media/cast/video_receiver/video_receiver.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698