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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc

Issue 1520513003: Fixed lint warnings in webrtc/modules/remote_bitrate_estimator (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Include in alphabetic order Created 5 years 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 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 579
580 TraceBasedDeliveryFilter::~TraceBasedDeliveryFilter() { 580 TraceBasedDeliveryFilter::~TraceBasedDeliveryFilter() {
581 } 581 }
582 582
583 bool TraceBasedDeliveryFilter::Init(const std::string& filename) { 583 bool TraceBasedDeliveryFilter::Init(const std::string& filename) {
584 FILE* trace_file = fopen(filename.c_str(), "r"); 584 FILE* trace_file = fopen(filename.c_str(), "r");
585 if (!trace_file) { 585 if (!trace_file) {
586 return false; 586 return false;
587 } 587 }
588 int64_t first_timestamp = -1; 588 int64_t first_timestamp = -1;
589 while(!feof(trace_file)) { 589 while (!feof(trace_file)) {
590 const size_t kMaxLineLength = 100; 590 const size_t kMaxLineLength = 100;
591 char line[kMaxLineLength]; 591 char line[kMaxLineLength];
592 if (fgets(line, kMaxLineLength, trace_file)) { 592 if (fgets(line, kMaxLineLength, trace_file)) {
593 std::string line_string(line); 593 std::string line_string(line);
594 std::istringstream buffer(line_string); 594 std::istringstream buffer(line_string);
595 int64_t timestamp; 595 int64_t timestamp;
596 buffer >> timestamp; 596 buffer >> timestamp;
597 timestamp /= 1000; // Convert to microseconds. 597 timestamp /= 1000; // Convert to microseconds.
598 if (first_timestamp == -1) 598 if (first_timestamp == -1)
599 first_timestamp = timestamp; 599 first_timestamp = timestamp;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 VideoSource::VideoSource(int flow_id, 673 VideoSource::VideoSource(int flow_id,
674 float fps, 674 float fps,
675 uint32_t kbps, 675 uint32_t kbps,
676 uint32_t ssrc, 676 uint32_t ssrc,
677 int64_t first_frame_offset_ms) 677 int64_t first_frame_offset_ms)
678 : kMaxPayloadSizeBytes(1200), 678 : kMaxPayloadSizeBytes(1200),
679 kTimestampBase(0xff80ff00ul), 679 kTimestampBase(0xff80ff00ul),
680 frame_period_ms_(1000.0 / fps), 680 frame_period_ms_(1000.0 / fps),
681 bits_per_second_(1000 * kbps), 681 bits_per_second_(1000 * kbps),
682 frame_size_bytes_(bits_per_second_ / 8 / fps), 682 frame_size_bytes_(bits_per_second_ / 8 / fps),
683 random_(0x12345678),
683 flow_id_(flow_id), 684 flow_id_(flow_id),
684 next_frame_ms_(first_frame_offset_ms), 685 next_frame_ms_(first_frame_offset_ms),
685 next_frame_rand_ms_(0), 686 next_frame_rand_ms_(0),
686 now_ms_(0), 687 now_ms_(0),
687 prototype_header_() { 688 prototype_header_() {
688 memset(&prototype_header_, 0, sizeof(prototype_header_)); 689 memset(&prototype_header_, 0, sizeof(prototype_header_));
689 prototype_header_.ssrc = ssrc; 690 prototype_header_.ssrc = ssrc;
690 prototype_header_.sequenceNumber = 0xf000u; 691 prototype_header_.sequenceNumber = 0xf000u;
691 } 692 }
692 693
(...skipping 13 matching lines...) Expand all
706 void VideoSource::RunFor(int64_t time_ms, Packets* in_out) { 707 void VideoSource::RunFor(int64_t time_ms, Packets* in_out) {
707 assert(in_out); 708 assert(in_out);
708 709
709 now_ms_ += time_ms; 710 now_ms_ += time_ms;
710 Packets new_packets; 711 Packets new_packets;
711 712
712 while (now_ms_ >= next_frame_ms_) { 713 while (now_ms_ >= next_frame_ms_) {
713 const int64_t kRandAmplitude = 2; 714 const int64_t kRandAmplitude = 2;
714 // A variance picked uniformly from {-1, 0, 1} ms is added to the frame 715 // A variance picked uniformly from {-1, 0, 1} ms is added to the frame
715 // timestamp. 716 // timestamp.
716 next_frame_rand_ms_ = 717 next_frame_rand_ms_ = kRandAmplitude * (random_.Rand<float>() - 0.5);
717 kRandAmplitude * static_cast<float>(rand()) / RAND_MAX -
718 kRandAmplitude / 2;
719 718
720 // Ensure frame will not have a negative timestamp. 719 // Ensure frame will not have a negative timestamp.
721 int64_t next_frame_ms = 720 int64_t next_frame_ms =
722 std::max<int64_t>(next_frame_ms_ + next_frame_rand_ms_, 0); 721 std::max<int64_t>(next_frame_ms_ + next_frame_rand_ms_, 0);
723 722
724 prototype_header_.timestamp = 723 prototype_header_.timestamp =
725 kTimestampBase + static_cast<uint32_t>(next_frame_ms * 90.0); 724 kTimestampBase + static_cast<uint32_t>(next_frame_ms * 90.0);
726 prototype_header_.extension.transmissionTimeOffset = 0; 725 prototype_header_.extension.transmissionTimeOffset = 0;
727 726
728 // Generate new packets for this frame, all with the same timestamp, 727 // Generate new packets for this frame, all with the same timestamp,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, 807 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size,
809 uint32_t remaining_payload) { 808 uint32_t remaining_payload) {
810 uint32_t fragments = 809 uint32_t fragments =
811 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; 810 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes;
812 uint32_t avg_size = (frame_size + fragments - 1) / fragments; 811 uint32_t avg_size = (frame_size + fragments - 1) / fragments;
813 return std::min(avg_size, remaining_payload); 812 return std::min(avg_size, remaining_payload);
814 } 813 }
815 } // namespace bwe 814 } // namespace bwe
816 } // namespace testing 815 } // namespace testing
817 } // namespace webrtc 816 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698