OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 void StreamGenerator::Init(uint16_t start_seq_num, int64_t current_time) { | 28 void StreamGenerator::Init(uint16_t start_seq_num, int64_t current_time) { |
29 packets_.clear(); | 29 packets_.clear(); |
30 sequence_number_ = start_seq_num; | 30 sequence_number_ = start_seq_num; |
31 start_time_ = current_time; | 31 start_time_ = current_time; |
32 memset(packet_buffer_, 0, sizeof(packet_buffer_)); | 32 memset(packet_buffer_, 0, sizeof(packet_buffer_)); |
33 } | 33 } |
34 | 34 |
35 void StreamGenerator::GenerateFrame(FrameType type, | 35 void StreamGenerator::GenerateFrame(FrameType type, |
36 int num_media_packets, | 36 int num_media_packets, |
37 int num_empty_packets, | 37 int num_empty_packets, |
38 int64_t current_time) { | 38 int64_t time_ms) { |
39 uint32_t timestamp = 90 * (current_time - start_time_); | 39 uint32_t timestamp = 90 * (time_ms - start_time_); |
40 for (int i = 0; i < num_media_packets; ++i) { | 40 for (int i = 0; i < num_media_packets; ++i) { |
41 const int packet_size = | 41 const int packet_size = |
42 (kFrameSize + num_media_packets / 2) / num_media_packets; | 42 (kFrameSize + num_media_packets / 2) / num_media_packets; |
43 bool marker_bit = (i == num_media_packets - 1); | 43 bool marker_bit = (i == num_media_packets - 1); |
44 packets_.push_back(GeneratePacket( | 44 packets_.push_back(GeneratePacket( |
45 sequence_number_, timestamp, packet_size, (i == 0), marker_bit, type)); | 45 sequence_number_, timestamp, packet_size, (i == 0), marker_bit, type)); |
46 ++sequence_number_; | 46 ++sequence_number_; |
47 } | 47 } |
48 for (int i = 0; i < num_empty_packets; ++i) { | 48 for (int i = 0; i < num_empty_packets; ++i) { |
49 packets_.push_back(GeneratePacket( | 49 packets_.push_back(GeneratePacket( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 std::list<VCMPacket>::iterator it = packets_.begin(); | 118 std::list<VCMPacket>::iterator it = packets_.begin(); |
119 for (int i = 0; i < index; ++i) { | 119 for (int i = 0; i < index; ++i) { |
120 ++it; | 120 ++it; |
121 if (it == packets_.end()) | 121 if (it == packets_.end()) |
122 break; | 122 break; |
123 } | 123 } |
124 return it; | 124 return it; |
125 } | 125 } |
126 | 126 |
127 } // namespace webrtc | 127 } // namespace webrtc |
OLD | NEW |