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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc

Issue 2937403002: Style fixes in rtcp_packet/ (Closed)
Patch Set: CR response Created 3 years, 6 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/rtp_rtcp/source/rtcp_packet/transport_feedback.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 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 return false; 538 return false;
539 } 539 }
540 if (size_bytes_ != packet_size) { 540 if (size_bytes_ != packet_size) {
541 LOG(LS_ERROR) << "Rtcp packet size mismatch. Calculated: " << packet_size 541 LOG(LS_ERROR) << "Rtcp packet size mismatch. Calculated: " << packet_size
542 << ". Saved: " << size_bytes_; 542 << ". Saved: " << size_bytes_;
543 return false; 543 return false;
544 } 544 }
545 return true; 545 return true;
546 } 546 }
547 547
548 size_t TransportFeedback::BlockLength() const {
549 // Round size_bytes_ up to multiple of 32bits.
550 return (size_bytes_ + 3) & (~static_cast<size_t>(3));
551 }
552
548 // Serialize packet. 553 // Serialize packet.
549 bool TransportFeedback::Create(uint8_t* packet, 554 bool TransportFeedback::Create(uint8_t* packet,
550 size_t* position, 555 size_t* position,
551 size_t max_length, 556 size_t max_length,
552 PacketReadyCallback* callback) const { 557 PacketReadyCallback* callback) const {
553 if (num_seq_no_ == 0) 558 if (num_seq_no_ == 0)
554 return false; 559 return false;
555 560
556 while (*position + BlockLength() > max_length) { 561 while (*position + BlockLength() > max_length) {
557 if (!OnBufferFull(packet, position, callback)) 562 if (!OnBufferFull(packet, position, callback))
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 } 600 }
596 } 601 }
597 602
598 while ((*position % 4) != 0) 603 while ((*position % 4) != 0)
599 packet[(*position)++] = 0; 604 packet[(*position)++] = 0;
600 605
601 RTC_DCHECK_EQ(*position, position_end); 606 RTC_DCHECK_EQ(*position, position_end);
602 return true; 607 return true;
603 } 608 }
604 609
605 size_t TransportFeedback::BlockLength() const {
606 // Round size_bytes_ up to multiple of 32bits.
607 return (size_bytes_ + 3) & (~static_cast<size_t>(3));
608 }
609
610 void TransportFeedback::Clear() { 610 void TransportFeedback::Clear() {
611 num_seq_no_ = 0; 611 num_seq_no_ = 0;
612 last_timestamp_us_ = GetBaseTimeUs(); 612 last_timestamp_us_ = GetBaseTimeUs();
613 packets_.clear(); 613 packets_.clear();
614 encoded_chunks_.clear(); 614 encoded_chunks_.clear();
615 last_chunk_->Clear(); 615 last_chunk_->Clear();
616 size_bytes_ = kTransportFeedbackHeaderSizeBytes; 616 size_bytes_ = kTransportFeedbackHeaderSizeBytes;
617 } 617 }
618 618
619 bool TransportFeedback::AddDeltaSize(DeltaSize delta_size) { 619 bool TransportFeedback::AddDeltaSize(DeltaSize delta_size) {
(...skipping 14 matching lines...) Expand all
634 634
635 encoded_chunks_.push_back(last_chunk_->Emit()); 635 encoded_chunks_.push_back(last_chunk_->Emit());
636 size_bytes_ += kChunkSizeBytes; 636 size_bytes_ += kChunkSizeBytes;
637 last_chunk_->Add(delta_size); 637 last_chunk_->Add(delta_size);
638 ++num_seq_no_; 638 ++num_seq_no_;
639 return true; 639 return true;
640 } 640 }
641 641
642 } // namespace rtcp 642 } // namespace rtcp
643 } // namespace webrtc 643 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698