| 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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 private: | 1515 private: |
| 1516 rtc::Event done_; | 1516 rtc::Event done_; |
| 1517 } tester; | 1517 } tester; |
| 1518 tester.RunTest(); | 1518 tester.RunTest(); |
| 1519 } | 1519 } |
| 1520 TEST_F(EndToEndTest, ObserversEncodedFrames) { | 1520 TEST_F(EndToEndTest, ObserversEncodedFrames) { |
| 1521 class EncodedFrameTestObserver : public EncodedFrameObserver { | 1521 class EncodedFrameTestObserver : public EncodedFrameObserver { |
| 1522 public: | 1522 public: |
| 1523 EncodedFrameTestObserver() | 1523 EncodedFrameTestObserver() |
| 1524 : length_(0), | 1524 : length_(0), |
| 1525 frame_type_(kFrameEmpty), | 1525 frame_type_(kEmptyFrame), |
| 1526 called_(EventWrapper::Create()) {} | 1526 called_(EventWrapper::Create()) {} |
| 1527 virtual ~EncodedFrameTestObserver() {} | 1527 virtual ~EncodedFrameTestObserver() {} |
| 1528 | 1528 |
| 1529 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) { | 1529 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) { |
| 1530 frame_type_ = encoded_frame.frame_type_; | 1530 frame_type_ = encoded_frame.frame_type_; |
| 1531 length_ = encoded_frame.length_; | 1531 length_ = encoded_frame.length_; |
| 1532 buffer_.reset(new uint8_t[length_]); | 1532 buffer_.reset(new uint8_t[length_]); |
| 1533 memcpy(buffer_.get(), encoded_frame.data_, length_); | 1533 memcpy(buffer_.get(), encoded_frame.data_, length_); |
| 1534 called_->Set(); | 1534 called_->Set(); |
| 1535 } | 1535 } |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2883 // network. | 2883 // network. |
| 2884 sender_state_ = kNetworkUp; | 2884 sender_state_ = kNetworkUp; |
| 2885 } | 2885 } |
| 2886 sender_call_->SignalNetworkState(kNetworkUp); | 2886 sender_call_->SignalNetworkState(kNetworkUp); |
| 2887 receiver_call_->SignalNetworkState(kNetworkUp); | 2887 receiver_call_->SignalNetworkState(kNetworkUp); |
| 2888 WaitForPacketsOrSilence(false, false); | 2888 WaitForPacketsOrSilence(false, false); |
| 2889 } | 2889 } |
| 2890 | 2890 |
| 2891 int32_t Encode(const VideoFrame& input_image, | 2891 int32_t Encode(const VideoFrame& input_image, |
| 2892 const CodecSpecificInfo* codec_specific_info, | 2892 const CodecSpecificInfo* codec_specific_info, |
| 2893 const std::vector<VideoFrameType>* frame_types) override { | 2893 const std::vector<FrameType>* frame_types) override { |
| 2894 { | 2894 { |
| 2895 rtc::CritScope lock(&test_crit_); | 2895 rtc::CritScope lock(&test_crit_); |
| 2896 if (sender_state_ == kNetworkDown) { | 2896 if (sender_state_ == kNetworkDown) { |
| 2897 ++down_frames_; | 2897 ++down_frames_; |
| 2898 EXPECT_LE(down_frames_, 1) | 2898 EXPECT_LE(down_frames_, 1) |
| 2899 << "Encoding more than one frame while network is down."; | 2899 << "Encoding more than one frame while network is down."; |
| 2900 if (down_frames_ > 1) | 2900 if (down_frames_ > 1) |
| 2901 encoded_frames_->Set(); | 2901 encoded_frames_->Set(); |
| 2902 } else { | 2902 } else { |
| 2903 encoded_frames_->Set(); | 2903 encoded_frames_->Set(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3006 Stop(); | 3006 Stop(); |
| 3007 DestroyStreams(); | 3007 DestroyStreams(); |
| 3008 } | 3008 } |
| 3009 | 3009 |
| 3010 TEST_F(EndToEndTest, NewSendStreamsRespectNetworkDown) { | 3010 TEST_F(EndToEndTest, NewSendStreamsRespectNetworkDown) { |
| 3011 class UnusedEncoder : public test::FakeEncoder { | 3011 class UnusedEncoder : public test::FakeEncoder { |
| 3012 public: | 3012 public: |
| 3013 UnusedEncoder() : FakeEncoder(Clock::GetRealTimeClock()) {} | 3013 UnusedEncoder() : FakeEncoder(Clock::GetRealTimeClock()) {} |
| 3014 int32_t Encode(const VideoFrame& input_image, | 3014 int32_t Encode(const VideoFrame& input_image, |
| 3015 const CodecSpecificInfo* codec_specific_info, | 3015 const CodecSpecificInfo* codec_specific_info, |
| 3016 const std::vector<VideoFrameType>* frame_types) override { | 3016 const std::vector<FrameType>* frame_types) override { |
| 3017 ADD_FAILURE() << "Unexpected frame encode."; | 3017 ADD_FAILURE() << "Unexpected frame encode."; |
| 3018 return test::FakeEncoder::Encode( | 3018 return test::FakeEncoder::Encode( |
| 3019 input_image, codec_specific_info, frame_types); | 3019 input_image, codec_specific_info, frame_types); |
| 3020 } | 3020 } |
| 3021 }; | 3021 }; |
| 3022 | 3022 |
| 3023 CreateSenderCall(Call::Config()); | 3023 CreateSenderCall(Call::Config()); |
| 3024 sender_call_->SignalNetworkState(kNetworkDown); | 3024 sender_call_->SignalNetworkState(kNetworkDown); |
| 3025 | 3025 |
| 3026 UnusedTransport transport; | 3026 UnusedTransport transport; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3131 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) | 3131 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) |
| 3132 << "Enabling RTX requires rtpmap: rtx negotiation."; | 3132 << "Enabling RTX requires rtpmap: rtx negotiation."; |
| 3133 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) | 3133 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) |
| 3134 << "Enabling RTP extensions require negotiation."; | 3134 << "Enabling RTP extensions require negotiation."; |
| 3135 | 3135 |
| 3136 VerifyEmptyNackConfig(default_receive_config.rtp.nack); | 3136 VerifyEmptyNackConfig(default_receive_config.rtp.nack); |
| 3137 VerifyEmptyFecConfig(default_receive_config.rtp.fec); | 3137 VerifyEmptyFecConfig(default_receive_config.rtp.fec); |
| 3138 } | 3138 } |
| 3139 | 3139 |
| 3140 } // namespace webrtc | 3140 } // namespace webrtc |
| OLD | NEW |