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

Side by Side Diff: webrtc/modules/pacing/paced_sender.cc

Issue 1962303002: Added cluster id to PacedSender::Callback::TimeToSendPacket. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addded probing cluster unittest. Created 4 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
« no previous file with comments | « webrtc/modules/pacing/paced_sender.h ('k') | webrtc/modules/pacing/paced_sender_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 UpdateBytesPerInterval(delta_time_ms); 392 UpdateBytesPerInterval(delta_time_ms);
393 } 393 }
394 while (!packets_->Empty()) { 394 while (!packets_->Empty()) {
395 if (media_budget_->bytes_remaining() == 0 && !prober_->IsProbing()) 395 if (media_budget_->bytes_remaining() == 0 && !prober_->IsProbing())
396 return; 396 return;
397 397
398 // Since we need to release the lock in order to send, we first pop the 398 // Since we need to release the lock in order to send, we first pop the
399 // element from the priority queue but keep it in storage, so that we can 399 // element from the priority queue but keep it in storage, so that we can
400 // reinsert it if send fails. 400 // reinsert it if send fails.
401 const paced_sender::Packet& packet = packets_->BeginPop(); 401 const paced_sender::Packet& packet = packets_->BeginPop();
402 int probe_cluster_id =
403 prober_->IsProbing() ? prober_->CurrentClusterId() : -1;
402 404
403 if (SendPacket(packet)) { 405 if (SendPacket(packet, probe_cluster_id)) {
404 // Send succeeded, remove it from the queue. 406 // Send succeeded, remove it from the queue.
405 packets_->FinalizePop(packet); 407 packets_->FinalizePop(packet);
406 if (prober_->IsProbing()) 408 if (prober_->IsProbing())
407 return; 409 return;
408 } else { 410 } else {
409 // Send failed, put it back into the queue. 411 // Send failed, put it back into the queue.
410 packets_->CancelPop(packet); 412 packets_->CancelPop(packet);
411 return; 413 return;
412 } 414 }
413 } 415 }
414 416
415 // TODO(holmer): Remove the paused_ check when issue 5307 has been fixed. 417 // TODO(holmer): Remove the paused_ check when issue 5307 has been fixed.
416 if (paused_ || !packets_->Empty()) 418 if (paused_ || !packets_->Empty())
417 return; 419 return;
418 420
419 size_t padding_needed; 421 size_t padding_needed;
420 if (prober_->IsProbing()) { 422 if (prober_->IsProbing()) {
421 padding_needed = prober_->RecommendedPacketSize(); 423 padding_needed = prober_->RecommendedPacketSize();
422 } else { 424 } else {
423 padding_needed = padding_budget_->bytes_remaining(); 425 padding_needed = padding_budget_->bytes_remaining();
424 } 426 }
425 427
426 if (padding_needed > 0) 428 if (padding_needed > 0)
427 SendPadding(static_cast<size_t>(padding_needed)); 429 SendPadding(static_cast<size_t>(padding_needed));
428 } 430 }
429 431
430 bool PacedSender::SendPacket(const paced_sender::Packet& packet) { 432 bool PacedSender::SendPacket(const paced_sender::Packet& packet,
433 int probe_cluster_id) {
431 // TODO(holmer): Because of this bug issue 5307 we have to send audio 434 // TODO(holmer): Because of this bug issue 5307 we have to send audio
432 // packets even when the pacer is paused. Here we assume audio packets are 435 // packets even when the pacer is paused. Here we assume audio packets are
433 // always high priority and that they are the only high priority packets. 436 // always high priority and that they are the only high priority packets.
434 if (paused_ && packet.priority != kHighPriority) 437 if (paused_ && packet.priority != kHighPriority)
435 return false; 438 return false;
436 critsect_->Leave(); 439 critsect_->Leave();
437 const bool success = packet_sender_->TimeToSendPacket( 440 const bool success = packet_sender_->TimeToSendPacket(
438 packet.ssrc, packet.sequence_number, packet.capture_time_ms, 441 packet.ssrc, packet.sequence_number, packet.capture_time_ms,
439 packet.retransmission); 442 packet.retransmission, probe_cluster_id);
440 critsect_->Enter(); 443 critsect_->Enter();
441 444
442 if (success) { 445 if (success) {
443 prober_->PacketSent(clock_->TimeInMilliseconds(), packet.bytes); 446 prober_->PacketSent(clock_->TimeInMilliseconds(), packet.bytes);
444 // TODO(holmer): High priority packets should only be accounted for if we 447 // TODO(holmer): High priority packets should only be accounted for if we
445 // are allocating bandwidth for audio. 448 // are allocating bandwidth for audio.
446 if (packet.priority != kHighPriority) { 449 if (packet.priority != kHighPriority) {
447 // Update media bytes sent. 450 // Update media bytes sent.
448 media_budget_->UseBudget(packet.bytes); 451 media_budget_->UseBudget(packet.bytes);
449 padding_budget_->UseBudget(packet.bytes); 452 padding_budget_->UseBudget(packet.bytes);
(...skipping 13 matching lines...) Expand all
463 media_budget_->UseBudget(bytes_sent); 466 media_budget_->UseBudget(bytes_sent);
464 padding_budget_->UseBudget(bytes_sent); 467 padding_budget_->UseBudget(bytes_sent);
465 } 468 }
466 } 469 }
467 470
468 void PacedSender::UpdateBytesPerInterval(int64_t delta_time_ms) { 471 void PacedSender::UpdateBytesPerInterval(int64_t delta_time_ms) {
469 media_budget_->IncreaseBudget(delta_time_ms); 472 media_budget_->IncreaseBudget(delta_time_ms);
470 padding_budget_->IncreaseBudget(delta_time_ms); 473 padding_budget_->IncreaseBudget(delta_time_ms);
471 } 474 }
472 } // namespace webrtc 475 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/paced_sender.h ('k') | webrtc/modules/pacing/paced_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698