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