| 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 |
| 11 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h" | 11 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h" |
| 12 | 12 |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h" | 15 #include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h" |
| 16 #include "webrtc/modules/audio_coding/neteq/packet.h" | 16 #include "webrtc/modules/audio_coding/neteq/packet.h" |
| 17 | 17 |
| 18 using ::testing::Return; | 18 using ::testing::Return; |
| 19 using ::testing::ReturnNull; | 19 using ::testing::ReturnNull; |
| 20 using ::testing::_; | 20 using ::testing::_; |
| 21 | 21 |
| 22 namespace webrtc { | 22 namespace webrtc { |
| 23 | 23 |
| 24 TEST(TimestampScaler, TestNoScaling) { | 24 TEST(TimestampScaler, TestNoScaling) { |
| 25 MockDecoderDatabase db; | 25 MockDecoderDatabase db; |
| 26 // Use PCMu, because it doesn't use scaled timestamps. | 26 // Use PCMu, because it doesn't use scaled timestamps. |
| 27 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderPCMu, "", 8000, | 27 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderPCMu, ""); |
| 28 nullptr); | |
| 29 static const uint8_t kRtpPayloadType = 0; | 28 static const uint8_t kRtpPayloadType = 0; |
| 30 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) | 29 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) |
| 31 .WillRepeatedly(Return(&info)); | 30 .WillRepeatedly(Return(&info)); |
| 32 | 31 |
| 33 TimestampScaler scaler(db); | 32 TimestampScaler scaler(db); |
| 34 // Test both sides of the timestamp wrap-around. | 33 // Test both sides of the timestamp wrap-around. |
| 35 for (uint32_t timestamp = 0xFFFFFFFF - 5; timestamp != 5; ++timestamp) { | 34 for (uint32_t timestamp = 0xFFFFFFFF - 5; timestamp != 5; ++timestamp) { |
| 36 // Scale to internal timestamp. | 35 // Scale to internal timestamp. |
| 37 EXPECT_EQ(timestamp, scaler.ToInternal(timestamp, kRtpPayloadType)); | 36 EXPECT_EQ(timestamp, scaler.ToInternal(timestamp, kRtpPayloadType)); |
| 38 // Scale back. | 37 // Scale back. |
| 39 EXPECT_EQ(timestamp, scaler.ToExternal(timestamp)); | 38 EXPECT_EQ(timestamp, scaler.ToExternal(timestamp)); |
| 40 } | 39 } |
| 41 | 40 |
| 42 EXPECT_CALL(db, Die()); // Called when database object is deleted. | 41 EXPECT_CALL(db, Die()); // Called when database object is deleted. |
| 43 } | 42 } |
| 44 | 43 |
| 45 TEST(TimestampScaler, TestNoScalingLargeStep) { | 44 TEST(TimestampScaler, TestNoScalingLargeStep) { |
| 46 MockDecoderDatabase db; | 45 MockDecoderDatabase db; |
| 47 // Use PCMu, because it doesn't use scaled timestamps. | 46 // Use PCMu, because it doesn't use scaled timestamps. |
| 48 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderPCMu, "", 8000, | 47 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderPCMu, ""); |
| 49 nullptr); | |
| 50 static const uint8_t kRtpPayloadType = 0; | 48 static const uint8_t kRtpPayloadType = 0; |
| 51 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) | 49 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) |
| 52 .WillRepeatedly(Return(&info)); | 50 .WillRepeatedly(Return(&info)); |
| 53 | 51 |
| 54 TimestampScaler scaler(db); | 52 TimestampScaler scaler(db); |
| 55 // Test both sides of the timestamp wrap-around. | 53 // Test both sides of the timestamp wrap-around. |
| 56 static const uint32_t kStep = 160; | 54 static const uint32_t kStep = 160; |
| 57 uint32_t start_timestamp = 0; | 55 uint32_t start_timestamp = 0; |
| 58 // |external_timestamp| will be a large positive value. | 56 // |external_timestamp| will be a large positive value. |
| 59 start_timestamp = start_timestamp - 5 * kStep; | 57 start_timestamp = start_timestamp - 5 * kStep; |
| 60 for (uint32_t timestamp = start_timestamp; timestamp != 5 * kStep; | 58 for (uint32_t timestamp = start_timestamp; timestamp != 5 * kStep; |
| 61 timestamp += kStep) { | 59 timestamp += kStep) { |
| 62 // Scale to internal timestamp. | 60 // Scale to internal timestamp. |
| 63 EXPECT_EQ(timestamp, scaler.ToInternal(timestamp, kRtpPayloadType)); | 61 EXPECT_EQ(timestamp, scaler.ToInternal(timestamp, kRtpPayloadType)); |
| 64 // Scale back. | 62 // Scale back. |
| 65 EXPECT_EQ(timestamp, scaler.ToExternal(timestamp)); | 63 EXPECT_EQ(timestamp, scaler.ToExternal(timestamp)); |
| 66 } | 64 } |
| 67 | 65 |
| 68 EXPECT_CALL(db, Die()); // Called when database object is deleted. | 66 EXPECT_CALL(db, Die()); // Called when database object is deleted. |
| 69 } | 67 } |
| 70 | 68 |
| 71 TEST(TimestampScaler, TestG722) { | 69 TEST(TimestampScaler, TestG722) { |
| 72 MockDecoderDatabase db; | 70 MockDecoderDatabase db; |
| 73 // Use G722, which has a factor 2 scaling. | 71 // Use G722, which has a factor 2 scaling. |
| 74 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, "", 16000, | 72 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, ""); |
| 75 nullptr); | |
| 76 static const uint8_t kRtpPayloadType = 17; | 73 static const uint8_t kRtpPayloadType = 17; |
| 77 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) | 74 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) |
| 78 .WillRepeatedly(Return(&info)); | 75 .WillRepeatedly(Return(&info)); |
| 79 | 76 |
| 80 TimestampScaler scaler(db); | 77 TimestampScaler scaler(db); |
| 81 // Test both sides of the timestamp wrap-around. | 78 // Test both sides of the timestamp wrap-around. |
| 82 uint32_t external_timestamp = 0xFFFFFFFF - 5; | 79 uint32_t external_timestamp = 0xFFFFFFFF - 5; |
| 83 uint32_t internal_timestamp = external_timestamp; | 80 uint32_t internal_timestamp = external_timestamp; |
| 84 for (; external_timestamp != 5; ++external_timestamp) { | 81 for (; external_timestamp != 5; ++external_timestamp) { |
| 85 // Scale to internal timestamp. | 82 // Scale to internal timestamp. |
| 86 EXPECT_EQ(internal_timestamp, | 83 EXPECT_EQ(internal_timestamp, |
| 87 scaler.ToInternal(external_timestamp, kRtpPayloadType)); | 84 scaler.ToInternal(external_timestamp, kRtpPayloadType)); |
| 88 // Scale back. | 85 // Scale back. |
| 89 EXPECT_EQ(external_timestamp, scaler.ToExternal(internal_timestamp)); | 86 EXPECT_EQ(external_timestamp, scaler.ToExternal(internal_timestamp)); |
| 90 internal_timestamp += 2; | 87 internal_timestamp += 2; |
| 91 } | 88 } |
| 92 | 89 |
| 93 EXPECT_CALL(db, Die()); // Called when database object is deleted. | 90 EXPECT_CALL(db, Die()); // Called when database object is deleted. |
| 94 } | 91 } |
| 95 | 92 |
| 96 TEST(TimestampScaler, TestG722LargeStep) { | 93 TEST(TimestampScaler, TestG722LargeStep) { |
| 97 MockDecoderDatabase db; | 94 MockDecoderDatabase db; |
| 98 // Use G722, which has a factor 2 scaling. | 95 // Use G722, which has a factor 2 scaling. |
| 99 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, "", 16000, | 96 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, ""); |
| 100 nullptr); | |
| 101 static const uint8_t kRtpPayloadType = 17; | 97 static const uint8_t kRtpPayloadType = 17; |
| 102 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) | 98 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) |
| 103 .WillRepeatedly(Return(&info)); | 99 .WillRepeatedly(Return(&info)); |
| 104 | 100 |
| 105 TimestampScaler scaler(db); | 101 TimestampScaler scaler(db); |
| 106 // Test both sides of the timestamp wrap-around. | 102 // Test both sides of the timestamp wrap-around. |
| 107 static const uint32_t kStep = 320; | 103 static const uint32_t kStep = 320; |
| 108 uint32_t external_timestamp = 0; | 104 uint32_t external_timestamp = 0; |
| 109 // |external_timestamp| will be a large positive value. | 105 // |external_timestamp| will be a large positive value. |
| 110 external_timestamp = external_timestamp - 5 * kStep; | 106 external_timestamp = external_timestamp - 5 * kStep; |
| 111 uint32_t internal_timestamp = external_timestamp; | 107 uint32_t internal_timestamp = external_timestamp; |
| 112 for (; external_timestamp != 5 * kStep; external_timestamp += kStep) { | 108 for (; external_timestamp != 5 * kStep; external_timestamp += kStep) { |
| 113 // Scale to internal timestamp. | 109 // Scale to internal timestamp. |
| 114 EXPECT_EQ(internal_timestamp, | 110 EXPECT_EQ(internal_timestamp, |
| 115 scaler.ToInternal(external_timestamp, kRtpPayloadType)); | 111 scaler.ToInternal(external_timestamp, kRtpPayloadType)); |
| 116 // Scale back. | 112 // Scale back. |
| 117 EXPECT_EQ(external_timestamp, scaler.ToExternal(internal_timestamp)); | 113 EXPECT_EQ(external_timestamp, scaler.ToExternal(internal_timestamp)); |
| 118 // Internal timestamp should be incremented with twice the step. | 114 // Internal timestamp should be incremented with twice the step. |
| 119 internal_timestamp += 2 * kStep; | 115 internal_timestamp += 2 * kStep; |
| 120 } | 116 } |
| 121 | 117 |
| 122 EXPECT_CALL(db, Die()); // Called when database object is deleted. | 118 EXPECT_CALL(db, Die()); // Called when database object is deleted. |
| 123 } | 119 } |
| 124 | 120 |
| 125 TEST(TimestampScaler, TestG722WithCng) { | 121 TEST(TimestampScaler, TestG722WithCng) { |
| 126 MockDecoderDatabase db; | 122 MockDecoderDatabase db; |
| 127 // Use G722, which has a factor 2 scaling. | 123 // Use G722, which has a factor 2 scaling. |
| 128 const DecoderDatabase::DecoderInfo info_g722(NetEqDecoder::kDecoderG722, "", | 124 const DecoderDatabase::DecoderInfo info_g722(NetEqDecoder::kDecoderG722, ""); |
| 129 16000, nullptr); | 125 const DecoderDatabase::DecoderInfo info_cng(NetEqDecoder::kDecoderCNGwb, ""); |
| 130 const DecoderDatabase::DecoderInfo info_cng(NetEqDecoder::kDecoderCNGwb, "", | |
| 131 16000, nullptr); | |
| 132 static const uint8_t kRtpPayloadTypeG722 = 17; | 126 static const uint8_t kRtpPayloadTypeG722 = 17; |
| 133 static const uint8_t kRtpPayloadTypeCng = 13; | 127 static const uint8_t kRtpPayloadTypeCng = 13; |
| 134 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadTypeG722)) | 128 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadTypeG722)) |
| 135 .WillRepeatedly(Return(&info_g722)); | 129 .WillRepeatedly(Return(&info_g722)); |
| 136 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadTypeCng)) | 130 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadTypeCng)) |
| 137 .WillRepeatedly(Return(&info_cng)); | 131 .WillRepeatedly(Return(&info_cng)); |
| 138 | 132 |
| 139 TimestampScaler scaler(db); | 133 TimestampScaler scaler(db); |
| 140 // Test both sides of the timestamp wrap-around. | 134 // Test both sides of the timestamp wrap-around. |
| 141 uint32_t external_timestamp = 0xFFFFFFFF - 5; | 135 uint32_t external_timestamp = 0xFFFFFFFF - 5; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 161 | 155 |
| 162 EXPECT_CALL(db, Die()); // Called when database object is deleted. | 156 EXPECT_CALL(db, Die()); // Called when database object is deleted. |
| 163 } | 157 } |
| 164 | 158 |
| 165 // Make sure that the method ToInternal(Packet* packet) is wired up correctly. | 159 // Make sure that the method ToInternal(Packet* packet) is wired up correctly. |
| 166 // Since it is simply calling the other ToInternal method, we are not doing | 160 // Since it is simply calling the other ToInternal method, we are not doing |
| 167 // as many tests here. | 161 // as many tests here. |
| 168 TEST(TimestampScaler, TestG722Packet) { | 162 TEST(TimestampScaler, TestG722Packet) { |
| 169 MockDecoderDatabase db; | 163 MockDecoderDatabase db; |
| 170 // Use G722, which has a factor 2 scaling. | 164 // Use G722, which has a factor 2 scaling. |
| 171 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, "", 16000, | 165 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, ""); |
| 172 nullptr); | |
| 173 static const uint8_t kRtpPayloadType = 17; | 166 static const uint8_t kRtpPayloadType = 17; |
| 174 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) | 167 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) |
| 175 .WillRepeatedly(Return(&info)); | 168 .WillRepeatedly(Return(&info)); |
| 176 | 169 |
| 177 TimestampScaler scaler(db); | 170 TimestampScaler scaler(db); |
| 178 // Test both sides of the timestamp wrap-around. | 171 // Test both sides of the timestamp wrap-around. |
| 179 uint32_t external_timestamp = 0xFFFFFFFF - 5; | 172 uint32_t external_timestamp = 0xFFFFFFFF - 5; |
| 180 uint32_t internal_timestamp = external_timestamp; | 173 uint32_t internal_timestamp = external_timestamp; |
| 181 Packet packet; | 174 Packet packet; |
| 182 packet.header.payloadType = kRtpPayloadType; | 175 packet.header.payloadType = kRtpPayloadType; |
| 183 for (; external_timestamp != 5; ++external_timestamp) { | 176 for (; external_timestamp != 5; ++external_timestamp) { |
| 184 packet.header.timestamp = external_timestamp; | 177 packet.header.timestamp = external_timestamp; |
| 185 // Scale to internal timestamp. | 178 // Scale to internal timestamp. |
| 186 scaler.ToInternal(&packet); | 179 scaler.ToInternal(&packet); |
| 187 EXPECT_EQ(internal_timestamp, packet.header.timestamp); | 180 EXPECT_EQ(internal_timestamp, packet.header.timestamp); |
| 188 internal_timestamp += 2; | 181 internal_timestamp += 2; |
| 189 } | 182 } |
| 190 | 183 |
| 191 EXPECT_CALL(db, Die()); // Called when database object is deleted. | 184 EXPECT_CALL(db, Die()); // Called when database object is deleted. |
| 192 } | 185 } |
| 193 | 186 |
| 194 // Make sure that the method ToInternal(PacketList* packet_list) is wired up | 187 // Make sure that the method ToInternal(PacketList* packet_list) is wired up |
| 195 // correctly. Since it is simply calling the ToInternal(Packet* packet) method, | 188 // correctly. Since it is simply calling the ToInternal(Packet* packet) method, |
| 196 // we are not doing as many tests here. | 189 // we are not doing as many tests here. |
| 197 TEST(TimestampScaler, TestG722PacketList) { | 190 TEST(TimestampScaler, TestG722PacketList) { |
| 198 MockDecoderDatabase db; | 191 MockDecoderDatabase db; |
| 199 // Use G722, which has a factor 2 scaling. | 192 // Use G722, which has a factor 2 scaling. |
| 200 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, "", 16000, | 193 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, ""); |
| 201 nullptr); | |
| 202 static const uint8_t kRtpPayloadType = 17; | 194 static const uint8_t kRtpPayloadType = 17; |
| 203 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) | 195 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) |
| 204 .WillRepeatedly(Return(&info)); | 196 .WillRepeatedly(Return(&info)); |
| 205 | 197 |
| 206 TimestampScaler scaler(db); | 198 TimestampScaler scaler(db); |
| 207 // Test both sides of the timestamp wrap-around. | 199 // Test both sides of the timestamp wrap-around. |
| 208 uint32_t external_timestamp = 0xFFFFFFFF - 5; | 200 uint32_t external_timestamp = 0xFFFFFFFF - 5; |
| 209 uint32_t internal_timestamp = external_timestamp; | 201 uint32_t internal_timestamp = external_timestamp; |
| 210 Packet packet1; | 202 Packet packet1; |
| 211 packet1.header.payloadType = kRtpPayloadType; | 203 packet1.header.payloadType = kRtpPayloadType; |
| 212 packet1.header.timestamp = external_timestamp; | 204 packet1.header.timestamp = external_timestamp; |
| 213 Packet packet2; | 205 Packet packet2; |
| 214 packet2.header.payloadType = kRtpPayloadType; | 206 packet2.header.payloadType = kRtpPayloadType; |
| 215 packet2.header.timestamp = external_timestamp + 10; | 207 packet2.header.timestamp = external_timestamp + 10; |
| 216 PacketList packet_list; | 208 PacketList packet_list; |
| 217 packet_list.push_back(&packet1); | 209 packet_list.push_back(&packet1); |
| 218 packet_list.push_back(&packet2); | 210 packet_list.push_back(&packet2); |
| 219 | 211 |
| 220 scaler.ToInternal(&packet_list); | 212 scaler.ToInternal(&packet_list); |
| 221 EXPECT_EQ(internal_timestamp, packet1.header.timestamp); | 213 EXPECT_EQ(internal_timestamp, packet1.header.timestamp); |
| 222 EXPECT_EQ(internal_timestamp + 20, packet2.header.timestamp); | 214 EXPECT_EQ(internal_timestamp + 20, packet2.header.timestamp); |
| 223 | 215 |
| 224 EXPECT_CALL(db, Die()); // Called when database object is deleted. | 216 EXPECT_CALL(db, Die()); // Called when database object is deleted. |
| 225 } | 217 } |
| 226 | 218 |
| 227 TEST(TimestampScaler, TestG722Reset) { | 219 TEST(TimestampScaler, TestG722Reset) { |
| 228 MockDecoderDatabase db; | 220 MockDecoderDatabase db; |
| 229 // Use G722, which has a factor 2 scaling. | 221 // Use G722, which has a factor 2 scaling. |
| 230 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, "", 16000, | 222 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderG722, ""); |
| 231 nullptr); | |
| 232 static const uint8_t kRtpPayloadType = 17; | 223 static const uint8_t kRtpPayloadType = 17; |
| 233 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) | 224 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) |
| 234 .WillRepeatedly(Return(&info)); | 225 .WillRepeatedly(Return(&info)); |
| 235 | 226 |
| 236 TimestampScaler scaler(db); | 227 TimestampScaler scaler(db); |
| 237 // Test both sides of the timestamp wrap-around. | 228 // Test both sides of the timestamp wrap-around. |
| 238 uint32_t external_timestamp = 0xFFFFFFFF - 5; | 229 uint32_t external_timestamp = 0xFFFFFFFF - 5; |
| 239 uint32_t internal_timestamp = external_timestamp; | 230 uint32_t internal_timestamp = external_timestamp; |
| 240 for (; external_timestamp != 5; ++external_timestamp) { | 231 for (; external_timestamp != 5; ++external_timestamp) { |
| 241 // Scale to internal timestamp. | 232 // Scale to internal timestamp. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 260 | 251 |
| 261 EXPECT_CALL(db, Die()); // Called when database object is deleted. | 252 EXPECT_CALL(db, Die()); // Called when database object is deleted. |
| 262 } | 253 } |
| 263 | 254 |
| 264 // TODO(minyue): This test becomes trivial since Opus does not need a timestamp | 255 // TODO(minyue): This test becomes trivial since Opus does not need a timestamp |
| 265 // scaler. Therefore, this test may be removed in future. There is no harm to | 256 // scaler. Therefore, this test may be removed in future. There is no harm to |
| 266 // keep it, since it can be taken as a test case for the situation of a trivial | 257 // keep it, since it can be taken as a test case for the situation of a trivial |
| 267 // timestamp scaler. | 258 // timestamp scaler. |
| 268 TEST(TimestampScaler, TestOpusLargeStep) { | 259 TEST(TimestampScaler, TestOpusLargeStep) { |
| 269 MockDecoderDatabase db; | 260 MockDecoderDatabase db; |
| 270 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderOpus, "", 48000, | 261 const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderOpus, ""); |
| 271 nullptr); | |
| 272 static const uint8_t kRtpPayloadType = 17; | 262 static const uint8_t kRtpPayloadType = 17; |
| 273 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) | 263 EXPECT_CALL(db, GetDecoderInfo(kRtpPayloadType)) |
| 274 .WillRepeatedly(Return(&info)); | 264 .WillRepeatedly(Return(&info)); |
| 275 | 265 |
| 276 TimestampScaler scaler(db); | 266 TimestampScaler scaler(db); |
| 277 // Test both sides of the timestamp wrap-around. | 267 // Test both sides of the timestamp wrap-around. |
| 278 static const uint32_t kStep = 960; | 268 static const uint32_t kStep = 960; |
| 279 uint32_t external_timestamp = 0; | 269 uint32_t external_timestamp = 0; |
| 280 // |external_timestamp| will be a large positive value. | 270 // |external_timestamp| will be a large positive value. |
| 281 external_timestamp = external_timestamp - 5 * kStep; | 271 external_timestamp = external_timestamp - 5 * kStep; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 302 uint32_t timestamp = 4711; // Some number. | 292 uint32_t timestamp = 4711; // Some number. |
| 303 EXPECT_EQ(timestamp, scaler.ToInternal(timestamp, kRtpPayloadType)); | 293 EXPECT_EQ(timestamp, scaler.ToInternal(timestamp, kRtpPayloadType)); |
| 304 | 294 |
| 305 Packet* packet = NULL; | 295 Packet* packet = NULL; |
| 306 scaler.ToInternal(packet); // Should not crash. That's all we can test. | 296 scaler.ToInternal(packet); // Should not crash. That's all we can test. |
| 307 | 297 |
| 308 EXPECT_CALL(db, Die()); // Called when database object is deleted. | 298 EXPECT_CALL(db, Die()); // Called when database object is deleted. |
| 309 } | 299 } |
| 310 | 300 |
| 311 } // namespace webrtc | 301 } // namespace webrtc |
| OLD | NEW |