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 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 private: | 1506 private: |
1507 rtc::Event done_; | 1507 rtc::Event done_; |
1508 } tester; | 1508 } tester; |
1509 tester.RunTest(); | 1509 tester.RunTest(); |
1510 } | 1510 } |
1511 TEST_F(EndToEndTest, ObserversEncodedFrames) { | 1511 TEST_F(EndToEndTest, ObserversEncodedFrames) { |
1512 class EncodedFrameTestObserver : public EncodedFrameObserver { | 1512 class EncodedFrameTestObserver : public EncodedFrameObserver { |
1513 public: | 1513 public: |
1514 EncodedFrameTestObserver() | 1514 EncodedFrameTestObserver() |
1515 : length_(0), | 1515 : length_(0), |
1516 frame_type_(kFrameEmpty), | 1516 frame_type_(kSkipFrame), |
1517 called_(EventWrapper::Create()) {} | 1517 called_(EventWrapper::Create()) {} |
1518 virtual ~EncodedFrameTestObserver() {} | 1518 virtual ~EncodedFrameTestObserver() {} |
1519 | 1519 |
1520 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) { | 1520 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) { |
1521 frame_type_ = encoded_frame.frame_type_; | 1521 frame_type_ = encoded_frame.frame_type_; |
1522 length_ = encoded_frame.length_; | 1522 length_ = encoded_frame.length_; |
1523 buffer_.reset(new uint8_t[length_]); | 1523 buffer_.reset(new uint8_t[length_]); |
1524 memcpy(buffer_.get(), encoded_frame.data_, length_); | 1524 memcpy(buffer_.get(), encoded_frame.data_, length_); |
1525 called_->Set(); | 1525 called_->Set(); |
1526 } | 1526 } |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 // network. | 2874 // network. |
2875 sender_state_ = kNetworkUp; | 2875 sender_state_ = kNetworkUp; |
2876 } | 2876 } |
2877 sender_call_->SignalNetworkState(kNetworkUp); | 2877 sender_call_->SignalNetworkState(kNetworkUp); |
2878 receiver_call_->SignalNetworkState(kNetworkUp); | 2878 receiver_call_->SignalNetworkState(kNetworkUp); |
2879 WaitForPacketsOrSilence(false, false); | 2879 WaitForPacketsOrSilence(false, false); |
2880 } | 2880 } |
2881 | 2881 |
2882 int32_t Encode(const VideoFrame& input_image, | 2882 int32_t Encode(const VideoFrame& input_image, |
2883 const CodecSpecificInfo* codec_specific_info, | 2883 const CodecSpecificInfo* codec_specific_info, |
2884 const std::vector<VideoFrameType>* frame_types) override { | 2884 const std::vector<FrameType>* frame_types) override { |
2885 { | 2885 { |
2886 rtc::CritScope lock(&test_crit_); | 2886 rtc::CritScope lock(&test_crit_); |
2887 if (sender_state_ == kNetworkDown) { | 2887 if (sender_state_ == kNetworkDown) { |
2888 ++down_frames_; | 2888 ++down_frames_; |
2889 EXPECT_LE(down_frames_, 1) | 2889 EXPECT_LE(down_frames_, 1) |
2890 << "Encoding more than one frame while network is down."; | 2890 << "Encoding more than one frame while network is down."; |
2891 if (down_frames_ > 1) | 2891 if (down_frames_ > 1) |
2892 encoded_frames_->Set(); | 2892 encoded_frames_->Set(); |
2893 } else { | 2893 } else { |
2894 encoded_frames_->Set(); | 2894 encoded_frames_->Set(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2997 Stop(); | 2997 Stop(); |
2998 DestroyStreams(); | 2998 DestroyStreams(); |
2999 } | 2999 } |
3000 | 3000 |
3001 TEST_F(EndToEndTest, NewSendStreamsRespectNetworkDown) { | 3001 TEST_F(EndToEndTest, NewSendStreamsRespectNetworkDown) { |
3002 class UnusedEncoder : public test::FakeEncoder { | 3002 class UnusedEncoder : public test::FakeEncoder { |
3003 public: | 3003 public: |
3004 UnusedEncoder() : FakeEncoder(Clock::GetRealTimeClock()) {} | 3004 UnusedEncoder() : FakeEncoder(Clock::GetRealTimeClock()) {} |
3005 int32_t Encode(const VideoFrame& input_image, | 3005 int32_t Encode(const VideoFrame& input_image, |
3006 const CodecSpecificInfo* codec_specific_info, | 3006 const CodecSpecificInfo* codec_specific_info, |
3007 const std::vector<VideoFrameType>* frame_types) override { | 3007 const std::vector<FrameType>* frame_types) override { |
3008 ADD_FAILURE() << "Unexpected frame encode."; | 3008 ADD_FAILURE() << "Unexpected frame encode."; |
3009 return test::FakeEncoder::Encode( | 3009 return test::FakeEncoder::Encode( |
3010 input_image, codec_specific_info, frame_types); | 3010 input_image, codec_specific_info, frame_types); |
3011 } | 3011 } |
3012 }; | 3012 }; |
3013 | 3013 |
3014 CreateSenderCall(Call::Config()); | 3014 CreateSenderCall(Call::Config()); |
3015 sender_call_->SignalNetworkState(kNetworkDown); | 3015 sender_call_->SignalNetworkState(kNetworkDown); |
3016 | 3016 |
3017 UnusedTransport transport; | 3017 UnusedTransport transport; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) | 3122 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) |
3123 << "Enabling RTX requires rtpmap: rtx negotiation."; | 3123 << "Enabling RTX requires rtpmap: rtx negotiation."; |
3124 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) | 3124 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) |
3125 << "Enabling RTP extensions require negotiation."; | 3125 << "Enabling RTP extensions require negotiation."; |
3126 | 3126 |
3127 VerifyEmptyNackConfig(default_receive_config.rtp.nack); | 3127 VerifyEmptyNackConfig(default_receive_config.rtp.nack); |
3128 VerifyEmptyFecConfig(default_receive_config.rtp.fec); | 3128 VerifyEmptyFecConfig(default_receive_config.rtp.fec); |
3129 } | 3129 } |
3130 | 3130 |
3131 } // namespace webrtc | 3131 } // namespace webrtc |
OLD | NEW |