OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 int nbr_packets_dropped = 0; | 39 int nbr_packets_dropped = 0; |
40 // There's no need to build a copy of the image data since viewing an | 40 // There's no need to build a copy of the image data since viewing an |
41 // EncodedImage object, setting the length to a new lower value represents | 41 // EncodedImage object, setting the length to a new lower value represents |
42 // that everything is dropped after that position in the byte array. | 42 // that everything is dropped after that position in the byte array. |
43 // EncodedImage._size is the allocated bytes. | 43 // EncodedImage._size is the allocated bytes. |
44 // EncodedImage._length is how many that are filled with data. | 44 // EncodedImage._length is how many that are filled with data. |
45 int new_length = 0; | 45 int new_length = 0; |
46 packet_reader_->InitializeReading(encoded_image->_buffer, | 46 packet_reader_->InitializeReading(encoded_image->_buffer, |
47 encoded_image->_length, | 47 encoded_image->_length, |
48 config_.packet_size_in_bytes); | 48 config_.packet_size_in_bytes); |
49 uint8_t* packet = NULL; | 49 uint8_t* packet = nullptr; |
50 int nbr_bytes_to_read; | 50 int nbr_bytes_to_read; |
51 // keep track of if we've lost any packets, since then we shall loose | 51 // keep track of if we've lost any packets, since then we shall loose |
52 // the remains of the current frame: | 52 // the remains of the current frame: |
53 bool packet_loss_has_occurred = false; | 53 bool packet_loss_has_occurred = false; |
54 while ((nbr_bytes_to_read = packet_reader_->NextPacket(&packet)) > 0) { | 54 while ((nbr_bytes_to_read = packet_reader_->NextPacket(&packet)) > 0) { |
55 // Check if we're currently in a packet loss burst that is not completed: | 55 // Check if we're currently in a packet loss burst that is not completed: |
56 if (active_burst_packets_ > 0) { | 56 if (active_burst_packets_ > 0) { |
57 active_burst_packets_--; | 57 active_burst_packets_--; |
58 nbr_packets_dropped++; | 58 nbr_packets_dropped++; |
59 } else if (RandomUniform() < config_.packet_loss_probability || | 59 } else if (RandomUniform() < config_.packet_loss_probability || |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 case kBurst: | 103 case kBurst: |
104 return "Burst"; | 104 return "Burst"; |
105 default: | 105 default: |
106 assert(false); | 106 assert(false); |
107 return "Unknown"; | 107 return "Unknown"; |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 } // namespace test | 111 } // namespace test |
112 } // namespace webrtc | 112 } // namespace webrtc |
OLD | NEW |