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 |
11 #include <string.h> | 11 #include <string.h> |
12 | 12 |
| 13 #include <memory> |
| 14 |
13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "webrtc/modules/audio_coding/acm2/initial_delay_manager.h" | 16 #include "webrtc/modules/audio_coding/acm2/initial_delay_manager.h" |
15 | 17 |
16 namespace webrtc { | 18 namespace webrtc { |
17 | 19 |
18 namespace acm2 { | 20 namespace acm2 { |
19 | 21 |
20 namespace { | 22 namespace { |
21 | 23 |
22 const uint8_t kAudioPayloadType = 0; | 24 const uint8_t kAudioPayloadType = 0; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 InitRtpInfo(&rtp_info_); | 73 InitRtpInfo(&rtp_info_); |
72 } | 74 } |
73 | 75 |
74 void GetNextRtpHeader(WebRtcRTPHeader* rtp_info, | 76 void GetNextRtpHeader(WebRtcRTPHeader* rtp_info, |
75 uint32_t* rtp_receive_timestamp) const { | 77 uint32_t* rtp_receive_timestamp) const { |
76 memcpy(rtp_info, &rtp_info_, sizeof(*rtp_info)); | 78 memcpy(rtp_info, &rtp_info_, sizeof(*rtp_info)); |
77 *rtp_receive_timestamp = rtp_receive_timestamp_; | 79 *rtp_receive_timestamp = rtp_receive_timestamp_; |
78 NextRtpHeader(rtp_info, rtp_receive_timestamp); | 80 NextRtpHeader(rtp_info, rtp_receive_timestamp); |
79 } | 81 } |
80 | 82 |
81 rtc::scoped_ptr<InitialDelayManager> manager_; | 83 std::unique_ptr<InitialDelayManager> manager_; |
82 WebRtcRTPHeader rtp_info_; | 84 WebRtcRTPHeader rtp_info_; |
83 uint32_t rtp_receive_timestamp_; | 85 uint32_t rtp_receive_timestamp_; |
84 }; | 86 }; |
85 | 87 |
86 TEST_F(InitialDelayManagerTest, Init) { | 88 TEST_F(InitialDelayManagerTest, Init) { |
87 EXPECT_TRUE(manager_->buffering()); | 89 EXPECT_TRUE(manager_->buffering()); |
88 EXPECT_FALSE(manager_->PacketBuffered()); | 90 EXPECT_FALSE(manager_->PacketBuffered()); |
89 manager_->DisableBuffering(); | 91 manager_->DisableBuffering(); |
90 EXPECT_FALSE(manager_->buffering()); | 92 EXPECT_FALSE(manager_->buffering()); |
91 InitialDelayManager::SyncStream sync_stream; | 93 InitialDelayManager::SyncStream sync_stream; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 manager_->UpdateLastReceivedPacket(rtp_info_, rtp_receive_timestamp_, | 369 manager_->UpdateLastReceivedPacket(rtp_info_, rtp_receive_timestamp_, |
368 InitialDelayManager::kAudioPacket, | 370 InitialDelayManager::kAudioPacket, |
369 false, kSamplingRateHz, &sync_stream); | 371 false, kSamplingRateHz, &sync_stream); |
370 EXPECT_EQ(0, sync_stream.num_sync_packets); | 372 EXPECT_EQ(0, sync_stream.num_sync_packets); |
371 EXPECT_FALSE(manager_->buffering()); | 373 EXPECT_FALSE(manager_->buffering()); |
372 } | 374 } |
373 | 375 |
374 } // namespace acm2 | 376 } // namespace acm2 |
375 | 377 |
376 } // namespace webrtc | 378 } // namespace webrtc |
OLD | NEW |