| 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 17 matching lines...) Expand all Loading... |
| 28 using ::testing::NiceMock; | 28 using ::testing::NiceMock; |
| 29 using ::testing::Sequence; | 29 using ::testing::Sequence; |
| 30 | 30 |
| 31 class VCMRobustnessTest : public ::testing::Test { | 31 class VCMRobustnessTest : public ::testing::Test { |
| 32 protected: | 32 protected: |
| 33 static const size_t kPayloadLen = 10; | 33 static const size_t kPayloadLen = 10; |
| 34 | 34 |
| 35 virtual void SetUp() { | 35 virtual void SetUp() { |
| 36 clock_.reset(new SimulatedClock(0)); | 36 clock_.reset(new SimulatedClock(0)); |
| 37 ASSERT_TRUE(clock_.get() != NULL); | 37 ASSERT_TRUE(clock_.get() != NULL); |
| 38 vcm_ = VideoCodingModule::Create(clock_.get(), &event_factory_); | 38 vcm_.reset(VideoCodingModule::Create(clock_.get(), &event_factory_)); |
| 39 ASSERT_TRUE(vcm_ != NULL); | 39 ASSERT_TRUE(vcm_ != NULL); |
| 40 const size_t kMaxNackListSize = 250; | 40 const size_t kMaxNackListSize = 250; |
| 41 const int kMaxPacketAgeToNack = 450; | 41 const int kMaxPacketAgeToNack = 450; |
| 42 vcm_->SetNackSettings(kMaxNackListSize, kMaxPacketAgeToNack, 0); | 42 vcm_->SetNackSettings(kMaxNackListSize, kMaxPacketAgeToNack, 0); |
| 43 ASSERT_EQ(0, vcm_->RegisterFrameTypeCallback(&frame_type_callback_)); | 43 ASSERT_EQ(0, vcm_->RegisterFrameTypeCallback(&frame_type_callback_)); |
| 44 ASSERT_EQ(0, vcm_->RegisterPacketRequestCallback(&request_callback_)); | 44 ASSERT_EQ(0, vcm_->RegisterPacketRequestCallback(&request_callback_)); |
| 45 VideoCodingModule::Codec(kVideoCodecVP8, &video_codec_); | 45 VideoCodingModule::Codec(kVideoCodecVP8, &video_codec_); |
| 46 ASSERT_EQ(VCM_OK, vcm_->RegisterReceiveCodec(&video_codec_, 1)); | 46 ASSERT_EQ(VCM_OK, vcm_->RegisterReceiveCodec(&video_codec_, 1)); |
| 47 vcm_->RegisterExternalDecoder(&decoder_, video_codec_.plType); | 47 vcm_->RegisterExternalDecoder(&decoder_, video_codec_.plType); |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual void TearDown() { VideoCodingModule::Destroy(vcm_); } | 50 virtual void TearDown() { vcm_.reset(); } |
| 51 | 51 |
| 52 void InsertPacket(uint32_t timestamp, | 52 void InsertPacket(uint32_t timestamp, |
| 53 uint16_t seq_no, | 53 uint16_t seq_no, |
| 54 bool first, | 54 bool first, |
| 55 bool marker_bit, | 55 bool marker_bit, |
| 56 FrameType frame_type) { | 56 FrameType frame_type) { |
| 57 const uint8_t payload[kPayloadLen] = {0}; | 57 const uint8_t payload[kPayloadLen] = {0}; |
| 58 WebRtcRTPHeader rtp_info; | 58 WebRtcRTPHeader rtp_info; |
| 59 memset(&rtp_info, 0, sizeof(rtp_info)); | 59 memset(&rtp_info, 0, sizeof(rtp_info)); |
| 60 rtp_info.frameType = frame_type; | 60 rtp_info.frameType = frame_type; |
| 61 rtp_info.header.timestamp = timestamp; | 61 rtp_info.header.timestamp = timestamp; |
| 62 rtp_info.header.sequenceNumber = seq_no; | 62 rtp_info.header.sequenceNumber = seq_no; |
| 63 rtp_info.header.markerBit = marker_bit; | 63 rtp_info.header.markerBit = marker_bit; |
| 64 rtp_info.header.payloadType = video_codec_.plType; | 64 rtp_info.header.payloadType = video_codec_.plType; |
| 65 rtp_info.type.Video.codec = kRtpVideoVp8; | 65 rtp_info.type.Video.codec = kRtpVideoVp8; |
| 66 rtp_info.type.Video.codecHeader.VP8.InitRTPVideoHeaderVP8(); | 66 rtp_info.type.Video.codecHeader.VP8.InitRTPVideoHeaderVP8(); |
| 67 rtp_info.type.Video.isFirstPacket = first; | 67 rtp_info.type.Video.isFirstPacket = first; |
| 68 | 68 |
| 69 ASSERT_EQ(VCM_OK, vcm_->IncomingPacket(payload, kPayloadLen, rtp_info)); | 69 ASSERT_EQ(VCM_OK, vcm_->IncomingPacket(payload, kPayloadLen, rtp_info)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 VideoCodingModule* vcm_; | 72 rtc::scoped_ptr<VideoCodingModule> vcm_; |
| 73 VideoCodec video_codec_; | 73 VideoCodec video_codec_; |
| 74 MockVCMFrameTypeCallback frame_type_callback_; | 74 MockVCMFrameTypeCallback frame_type_callback_; |
| 75 MockPacketRequestCallback request_callback_; | 75 MockPacketRequestCallback request_callback_; |
| 76 NiceMock<MockVideoDecoder> decoder_; | 76 NiceMock<MockVideoDecoder> decoder_; |
| 77 NiceMock<MockVideoDecoder> decoderCopy_; | 77 NiceMock<MockVideoDecoder> decoderCopy_; |
| 78 rtc::scoped_ptr<SimulatedClock> clock_; | 78 rtc::scoped_ptr<SimulatedClock> clock_; |
| 79 NullEventFactory event_factory_; | 79 NullEventFactory event_factory_; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 TEST_F(VCMRobustnessTest, TestHardNack) { | 82 TEST_F(VCMRobustnessTest, TestHardNack) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 clock_->AdvanceTimeMilliseconds(23); | 218 clock_->AdvanceTimeMilliseconds(23); |
| 219 InsertPacket(3000, 4, false, false, kVideoFrameDelta); | 219 InsertPacket(3000, 4, false, false, kVideoFrameDelta); |
| 220 | 220 |
| 221 InsertPacket(9000, 9, true, false, kVideoFrameDelta); | 221 InsertPacket(9000, 9, true, false, kVideoFrameDelta); |
| 222 InsertPacket(9000, 10, false, false, kVideoFrameDelta); | 222 InsertPacket(9000, 10, false, false, kVideoFrameDelta); |
| 223 InsertPacket(9000, 11, false, true, kVideoFrameDelta); | 223 InsertPacket(9000, 11, false, true, kVideoFrameDelta); |
| 224 EXPECT_EQ(VCM_OK, vcm_->Decode(33)); // Decode timestamp 9000 complete. | 224 EXPECT_EQ(VCM_OK, vcm_->Decode(33)); // Decode timestamp 9000 complete. |
| 225 } | 225 } |
| 226 } // namespace webrtc | 226 } // namespace webrtc |
| OLD | NEW |