| 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 25 matching lines...) Expand all Loading... |
| 36 namespace cricket { | 36 namespace cricket { |
| 37 class FakeAudioSendStream final : public webrtc::AudioSendStream { | 37 class FakeAudioSendStream final : public webrtc::AudioSendStream { |
| 38 public: | 38 public: |
| 39 struct TelephoneEvent { | 39 struct TelephoneEvent { |
| 40 int payload_type = -1; | 40 int payload_type = -1; |
| 41 int payload_frequency = -1; | 41 int payload_frequency = -1; |
| 42 int event_code = 0; | 42 int event_code = 0; |
| 43 int duration_ms = 0; | 43 int duration_ms = 0; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 explicit FakeAudioSendStream(const webrtc::AudioSendStream::Config& config); | 46 explicit FakeAudioSendStream( |
| 47 int id, const webrtc::AudioSendStream::Config& config); |
| 47 | 48 |
| 49 int id() const { return id_; } |
| 48 const webrtc::AudioSendStream::Config& GetConfig() const; | 50 const webrtc::AudioSendStream::Config& GetConfig() const; |
| 49 void SetStats(const webrtc::AudioSendStream::Stats& stats); | 51 void SetStats(const webrtc::AudioSendStream::Stats& stats); |
| 50 TelephoneEvent GetLatestTelephoneEvent() const; | 52 TelephoneEvent GetLatestTelephoneEvent() const; |
| 51 bool IsSending() const { return sending_; } | 53 bool IsSending() const { return sending_; } |
| 52 bool muted() const { return muted_; } | 54 bool muted() const { return muted_; } |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 // webrtc::AudioSendStream implementation. | 57 // webrtc::AudioSendStream implementation. |
| 56 void Start() override { sending_ = true; } | 58 void Start() override { sending_ = true; } |
| 57 void Stop() override { sending_ = false; } | 59 void Stop() override { sending_ = false; } |
| 58 | 60 |
| 59 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, | 61 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, |
| 60 int duration_ms) override; | 62 int duration_ms) override; |
| 61 void SetMuted(bool muted) override; | 63 void SetMuted(bool muted) override; |
| 62 webrtc::AudioSendStream::Stats GetStats() const override; | 64 webrtc::AudioSendStream::Stats GetStats() const override; |
| 63 | 65 |
| 66 int id_ = -1; |
| 64 TelephoneEvent latest_telephone_event_; | 67 TelephoneEvent latest_telephone_event_; |
| 65 webrtc::AudioSendStream::Config config_; | 68 webrtc::AudioSendStream::Config config_; |
| 66 webrtc::AudioSendStream::Stats stats_; | 69 webrtc::AudioSendStream::Stats stats_; |
| 67 bool sending_ = false; | 70 bool sending_ = false; |
| 68 bool muted_ = false; | 71 bool muted_ = false; |
| 69 }; | 72 }; |
| 70 | 73 |
| 71 class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { | 74 class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { |
| 72 public: | 75 public: |
| 73 explicit FakeAudioReceiveStream( | 76 explicit FakeAudioReceiveStream( |
| 74 const webrtc::AudioReceiveStream::Config& config); | 77 int id, const webrtc::AudioReceiveStream::Config& config); |
| 75 | 78 |
| 79 int id() const { return id_; } |
| 76 const webrtc::AudioReceiveStream::Config& GetConfig() const; | 80 const webrtc::AudioReceiveStream::Config& GetConfig() const; |
| 77 void SetStats(const webrtc::AudioReceiveStream::Stats& stats); | 81 void SetStats(const webrtc::AudioReceiveStream::Stats& stats); |
| 78 int received_packets() const { return received_packets_; } | 82 int received_packets() const { return received_packets_; } |
| 79 bool VerifyLastPacket(const uint8_t* data, size_t length) const; | 83 bool VerifyLastPacket(const uint8_t* data, size_t length) const; |
| 80 const webrtc::AudioSinkInterface* sink() const { return sink_.get(); } | 84 const webrtc::AudioSinkInterface* sink() const { return sink_.get(); } |
| 81 float gain() const { return gain_; } | 85 float gain() const { return gain_; } |
| 82 bool DeliverRtp(const uint8_t* packet, | 86 bool DeliverRtp(const uint8_t* packet, |
| 83 size_t length, | 87 size_t length, |
| 84 const webrtc::PacketTime& packet_time); | 88 const webrtc::PacketTime& packet_time); |
| 85 bool started() const { return started_; } | 89 bool started() const { return started_; } |
| 86 | 90 |
| 87 private: | 91 private: |
| 88 // webrtc::AudioReceiveStream implementation. | 92 // webrtc::AudioReceiveStream implementation. |
| 89 void Start() override { started_ = true; } | 93 void Start() override { started_ = true; } |
| 90 void Stop() override { started_ = false; } | 94 void Stop() override { started_ = false; } |
| 91 | 95 |
| 92 webrtc::AudioReceiveStream::Stats GetStats() const override; | 96 webrtc::AudioReceiveStream::Stats GetStats() const override; |
| 93 void SetSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) override; | 97 void SetSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) override; |
| 94 void SetGain(float gain) override; | 98 void SetGain(float gain) override; |
| 95 | 99 |
| 100 int id_ = -1; |
| 96 webrtc::AudioReceiveStream::Config config_; | 101 webrtc::AudioReceiveStream::Config config_; |
| 97 webrtc::AudioReceiveStream::Stats stats_; | 102 webrtc::AudioReceiveStream::Stats stats_; |
| 98 int received_packets_ = 0; | 103 int received_packets_ = 0; |
| 99 std::unique_ptr<webrtc::AudioSinkInterface> sink_; | 104 std::unique_ptr<webrtc::AudioSinkInterface> sink_; |
| 100 float gain_ = 1.0f; | 105 float gain_ = 1.0f; |
| 101 rtc::Buffer last_packet_; | 106 rtc::Buffer last_packet_; |
| 102 bool started_ = false; | 107 bool started_ = false; |
| 103 }; | 108 }; |
| 104 | 109 |
| 105 class FakeVideoSendStream final | 110 class FakeVideoSendStream final |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 webrtc::NetworkState state) override; | 291 webrtc::NetworkState state) override; |
| 287 void OnTransportOverheadChanged(webrtc::MediaType media, | 292 void OnTransportOverheadChanged(webrtc::MediaType media, |
| 288 int transport_overhead_per_packet) override; | 293 int transport_overhead_per_packet) override; |
| 289 void OnSentPacket(const rtc::SentPacket& sent_packet) override; | 294 void OnSentPacket(const rtc::SentPacket& sent_packet) override; |
| 290 | 295 |
| 291 webrtc::Call::Config config_; | 296 webrtc::Call::Config config_; |
| 292 webrtc::NetworkState audio_network_state_; | 297 webrtc::NetworkState audio_network_state_; |
| 293 webrtc::NetworkState video_network_state_; | 298 webrtc::NetworkState video_network_state_; |
| 294 rtc::SentPacket last_sent_packet_; | 299 rtc::SentPacket last_sent_packet_; |
| 295 int last_sent_nonnegative_packet_id_ = -1; | 300 int last_sent_nonnegative_packet_id_ = -1; |
| 301 int next_stream_id_ = 665; |
| 296 webrtc::Call::Stats stats_; | 302 webrtc::Call::Stats stats_; |
| 297 std::vector<FakeVideoSendStream*> video_send_streams_; | 303 std::vector<FakeVideoSendStream*> video_send_streams_; |
| 298 std::vector<FakeAudioSendStream*> audio_send_streams_; | 304 std::vector<FakeAudioSendStream*> audio_send_streams_; |
| 299 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 305 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
| 300 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 306 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
| 301 std::vector<FakeFlexfecReceiveStream*> flexfec_receive_streams_; | 307 std::vector<FakeFlexfecReceiveStream*> flexfec_receive_streams_; |
| 302 | 308 |
| 303 int num_created_send_streams_; | 309 int num_created_send_streams_; |
| 304 int num_created_receive_streams_; | 310 int num_created_receive_streams_; |
| 305 | 311 |
| 306 int audio_transport_overhead_; | 312 int audio_transport_overhead_; |
| 307 int video_transport_overhead_; | 313 int video_transport_overhead_; |
| 308 }; | 314 }; |
| 309 | 315 |
| 310 } // namespace cricket | 316 } // namespace cricket |
| 311 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_ | 317 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_ |
| OLD | NEW |