| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 30 matching lines...) Expand all Loading... |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 explicit FakeAudioSendStream(const webrtc::AudioSendStream::Config& config); | 43 explicit FakeAudioSendStream(const webrtc::AudioSendStream::Config& config); |
| 44 | 44 |
| 45 const webrtc::AudioSendStream::Config& GetConfig() const; | 45 const webrtc::AudioSendStream::Config& GetConfig() const; |
| 46 void SetStats(const webrtc::AudioSendStream::Stats& stats); | 46 void SetStats(const webrtc::AudioSendStream::Stats& stats); |
| 47 TelephoneEvent GetLatestTelephoneEvent() const; | 47 TelephoneEvent GetLatestTelephoneEvent() const; |
| 48 bool IsSending() const { return sending_; } | 48 bool IsSending() const { return sending_; } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // webrtc::SendStream implementation. | 51 // webrtc::AudioSendStream implementation. |
| 52 void Start() override { sending_ = true; } | 52 void Start() override { sending_ = true; } |
| 53 void Stop() override { sending_ = false; } | 53 void Stop() override { sending_ = false; } |
| 54 void SignalNetworkState(webrtc::NetworkState state) override {} | |
| 55 bool DeliverRtcp(const uint8_t* packet, size_t length) override { | |
| 56 return true; | |
| 57 } | |
| 58 | 54 |
| 59 // webrtc::AudioSendStream implementation. | |
| 60 bool SendTelephoneEvent(int payload_type, int event, | 55 bool SendTelephoneEvent(int payload_type, int event, |
| 61 int duration_ms) override; | 56 int duration_ms) override; |
| 62 webrtc::AudioSendStream::Stats GetStats() const override; | 57 webrtc::AudioSendStream::Stats GetStats() const override; |
| 63 | 58 |
| 64 TelephoneEvent latest_telephone_event_; | 59 TelephoneEvent latest_telephone_event_; |
| 65 webrtc::AudioSendStream::Config config_; | 60 webrtc::AudioSendStream::Config config_; |
| 66 webrtc::AudioSendStream::Stats stats_; | 61 webrtc::AudioSendStream::Stats stats_; |
| 67 bool sending_ = false; | 62 bool sending_ = false; |
| 68 }; | 63 }; |
| 69 | 64 |
| 70 class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { | 65 class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { |
| 71 public: | 66 public: |
| 72 explicit FakeAudioReceiveStream( | 67 explicit FakeAudioReceiveStream( |
| 73 const webrtc::AudioReceiveStream::Config& config); | 68 const webrtc::AudioReceiveStream::Config& config); |
| 74 | 69 |
| 75 const webrtc::AudioReceiveStream::Config& GetConfig() const; | 70 const webrtc::AudioReceiveStream::Config& GetConfig() const; |
| 76 void SetStats(const webrtc::AudioReceiveStream::Stats& stats); | 71 void SetStats(const webrtc::AudioReceiveStream::Stats& stats); |
| 77 int received_packets() const { return received_packets_; } | 72 int received_packets() const { return received_packets_; } |
| 78 bool VerifyLastPacket(const uint8_t* data, size_t length) const; | 73 bool VerifyLastPacket(const uint8_t* data, size_t length) const; |
| 79 const webrtc::AudioSinkInterface* sink() const { return sink_.get(); } | 74 const webrtc::AudioSinkInterface* sink() const { return sink_.get(); } |
| 80 | |
| 81 bool DeliverRtp(const uint8_t* packet, | 75 bool DeliverRtp(const uint8_t* packet, |
| 82 size_t length, | 76 size_t length, |
| 83 const webrtc::PacketTime& packet_time) override; | 77 const webrtc::PacketTime& packet_time); |
| 84 bool DeliverRtcp(const uint8_t* packet, size_t length) override; | 78 |
| 85 private: | 79 private: |
| 86 // webrtc::ReceiveStream implementation. | 80 // webrtc::AudioReceiveStream implementation. |
| 87 void Start() override {} | 81 void Start() override {} |
| 88 void Stop() override {} | 82 void Stop() override {} |
| 89 void SignalNetworkState(webrtc::NetworkState state) override {} | |
| 90 | 83 |
| 91 // webrtc::AudioReceiveStream implementation. | |
| 92 webrtc::AudioReceiveStream::Stats GetStats() const override; | 84 webrtc::AudioReceiveStream::Stats GetStats() const override; |
| 93 void SetSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) override; | 85 void SetSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) override; |
| 94 | 86 |
| 95 webrtc::AudioReceiveStream::Config config_; | 87 webrtc::AudioReceiveStream::Config config_; |
| 96 webrtc::AudioReceiveStream::Stats stats_; | 88 webrtc::AudioReceiveStream::Stats stats_; |
| 97 int received_packets_; | 89 int received_packets_; |
| 98 std::unique_ptr<webrtc::AudioSinkInterface> sink_; | 90 std::unique_ptr<webrtc::AudioSinkInterface> sink_; |
| 99 rtc::Buffer last_packet_; | 91 rtc::Buffer last_packet_; |
| 100 }; | 92 }; |
| 101 | 93 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 117 int GetLastHeight() const; | 109 int GetLastHeight() const; |
| 118 int64_t GetLastTimestamp() const; | 110 int64_t GetLastTimestamp() const; |
| 119 void SetStats(const webrtc::VideoSendStream::Stats& stats); | 111 void SetStats(const webrtc::VideoSendStream::Stats& stats); |
| 120 int num_encoder_reconfigurations() const { | 112 int num_encoder_reconfigurations() const { |
| 121 return num_encoder_reconfigurations_; | 113 return num_encoder_reconfigurations_; |
| 122 } | 114 } |
| 123 | 115 |
| 124 private: | 116 private: |
| 125 void IncomingCapturedFrame(const webrtc::VideoFrame& frame) override; | 117 void IncomingCapturedFrame(const webrtc::VideoFrame& frame) override; |
| 126 | 118 |
| 127 // webrtc::SendStream implementation. | 119 // webrtc::VideoSendStream implementation. |
| 128 void Start() override; | 120 void Start() override; |
| 129 void Stop() override; | 121 void Stop() override; |
| 130 void SignalNetworkState(webrtc::NetworkState state) override {} | |
| 131 bool DeliverRtcp(const uint8_t* packet, size_t length) override { | |
| 132 return true; | |
| 133 } | |
| 134 | |
| 135 // webrtc::VideoSendStream implementation. | |
| 136 webrtc::VideoSendStream::Stats GetStats() override; | 122 webrtc::VideoSendStream::Stats GetStats() override; |
| 137 void ReconfigureVideoEncoder( | 123 void ReconfigureVideoEncoder( |
| 138 const webrtc::VideoEncoderConfig& config) override; | 124 const webrtc::VideoEncoderConfig& config) override; |
| 139 webrtc::VideoCaptureInput* Input() override; | 125 webrtc::VideoCaptureInput* Input() override; |
| 140 | 126 |
| 141 bool sending_; | 127 bool sending_; |
| 142 webrtc::VideoSendStream::Config config_; | 128 webrtc::VideoSendStream::Config config_; |
| 143 webrtc::VideoEncoderConfig encoder_config_; | 129 webrtc::VideoEncoderConfig encoder_config_; |
| 144 bool codec_settings_set_; | 130 bool codec_settings_set_; |
| 145 union VpxSettings { | 131 union VpxSettings { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 159 | 145 |
| 160 webrtc::VideoReceiveStream::Config GetConfig(); | 146 webrtc::VideoReceiveStream::Config GetConfig(); |
| 161 | 147 |
| 162 bool IsReceiving() const; | 148 bool IsReceiving() const; |
| 163 | 149 |
| 164 void InjectFrame(const webrtc::VideoFrame& frame); | 150 void InjectFrame(const webrtc::VideoFrame& frame); |
| 165 | 151 |
| 166 void SetStats(const webrtc::VideoReceiveStream::Stats& stats); | 152 void SetStats(const webrtc::VideoReceiveStream::Stats& stats); |
| 167 | 153 |
| 168 private: | 154 private: |
| 169 // webrtc::ReceiveStream implementation. | 155 // webrtc::VideoReceiveStream implementation. |
| 170 void Start() override; | 156 void Start() override; |
| 171 void Stop() override; | 157 void Stop() override; |
| 172 void SignalNetworkState(webrtc::NetworkState state) override {} | |
| 173 bool DeliverRtcp(const uint8_t* packet, size_t length) override { | |
| 174 return true; | |
| 175 } | |
| 176 bool DeliverRtp(const uint8_t* packet, | |
| 177 size_t length, | |
| 178 const webrtc::PacketTime& packet_time) override { | |
| 179 return true; | |
| 180 } | |
| 181 | 158 |
| 182 // webrtc::VideoReceiveStream implementation. | |
| 183 webrtc::VideoReceiveStream::Stats GetStats() const override; | 159 webrtc::VideoReceiveStream::Stats GetStats() const override; |
| 184 | 160 |
| 185 webrtc::VideoReceiveStream::Config config_; | 161 webrtc::VideoReceiveStream::Config config_; |
| 186 bool receiving_; | 162 bool receiving_; |
| 187 webrtc::VideoReceiveStream::Stats stats_; | 163 webrtc::VideoReceiveStream::Stats stats_; |
| 188 }; | 164 }; |
| 189 | 165 |
| 190 class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver { | 166 class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver { |
| 191 public: | 167 public: |
| 192 explicit FakeCall(const webrtc::Call::Config& config); | 168 explicit FakeCall(const webrtc::Call::Config& config); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 std::vector<FakeAudioSendStream*> audio_send_streams_; | 228 std::vector<FakeAudioSendStream*> audio_send_streams_; |
| 253 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 229 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
| 254 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 230 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
| 255 | 231 |
| 256 int num_created_send_streams_; | 232 int num_created_send_streams_; |
| 257 int num_created_receive_streams_; | 233 int num_created_receive_streams_; |
| 258 }; | 234 }; |
| 259 | 235 |
| 260 } // namespace cricket | 236 } // namespace cricket |
| 261 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ | 237 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ |
| OLD | NEW |