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 26 matching lines...) Expand all Loading... |
37 int payload_type = -1; | 37 int payload_type = -1; |
38 uint8_t event_code = 0; | 38 uint8_t event_code = 0; |
39 uint32_t duration_ms = 0; | 39 uint32_t duration_ms = 0; |
40 }; | 40 }; |
41 | 41 |
42 explicit FakeAudioSendStream(const webrtc::AudioSendStream::Config& config); | 42 explicit FakeAudioSendStream(const webrtc::AudioSendStream::Config& config); |
43 | 43 |
44 const webrtc::AudioSendStream::Config& GetConfig() const; | 44 const webrtc::AudioSendStream::Config& GetConfig() const; |
45 void SetStats(const webrtc::AudioSendStream::Stats& stats); | 45 void SetStats(const webrtc::AudioSendStream::Stats& stats); |
46 TelephoneEvent GetLatestTelephoneEvent() const; | 46 TelephoneEvent GetLatestTelephoneEvent() const; |
| 47 bool IsSending() const { return sending_; } |
47 | 48 |
48 private: | 49 private: |
49 // webrtc::SendStream implementation. | 50 // webrtc::SendStream implementation. |
50 void Start() override {} | 51 void Start() override { sending_ = true; } |
51 void Stop() override {} | 52 void Stop() override { sending_ = false; } |
52 void SignalNetworkState(webrtc::NetworkState state) override {} | 53 void SignalNetworkState(webrtc::NetworkState state) override {} |
53 bool DeliverRtcp(const uint8_t* packet, size_t length) override { | 54 bool DeliverRtcp(const uint8_t* packet, size_t length) override { |
54 return true; | 55 return true; |
55 } | 56 } |
56 | 57 |
57 // webrtc::AudioSendStream implementation. | 58 // webrtc::AudioSendStream implementation. |
58 bool SendTelephoneEvent(int payload_type, uint8_t event, | 59 bool SendTelephoneEvent(int payload_type, uint8_t event, |
59 uint32_t duration_ms) override; | 60 uint32_t duration_ms) override; |
60 webrtc::AudioSendStream::Stats GetStats() const override; | 61 webrtc::AudioSendStream::Stats GetStats() const override; |
61 | 62 |
62 TelephoneEvent latest_telephone_event_; | 63 TelephoneEvent latest_telephone_event_; |
63 webrtc::AudioSendStream::Config config_; | 64 webrtc::AudioSendStream::Config config_; |
64 webrtc::AudioSendStream::Stats stats_; | 65 webrtc::AudioSendStream::Stats stats_; |
| 66 bool sending_ = false; |
65 }; | 67 }; |
66 | 68 |
67 class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { | 69 class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { |
68 public: | 70 public: |
69 explicit FakeAudioReceiveStream( | 71 explicit FakeAudioReceiveStream( |
70 const webrtc::AudioReceiveStream::Config& config); | 72 const webrtc::AudioReceiveStream::Config& config); |
71 | 73 |
72 const webrtc::AudioReceiveStream::Config& GetConfig() const; | 74 const webrtc::AudioReceiveStream::Config& GetConfig() const; |
73 void SetStats(const webrtc::AudioReceiveStream::Stats& stats); | 75 void SetStats(const webrtc::AudioReceiveStream::Stats& stats); |
74 int received_packets() const { return received_packets_; } | 76 int received_packets() const { return received_packets_; } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 std::vector<FakeAudioSendStream*> audio_send_streams_; | 246 std::vector<FakeAudioSendStream*> audio_send_streams_; |
245 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 247 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
246 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 248 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
247 | 249 |
248 int num_created_send_streams_; | 250 int num_created_send_streams_; |
249 int num_created_receive_streams_; | 251 int num_created_receive_streams_; |
250 }; | 252 }; |
251 | 253 |
252 } // namespace cricket | 254 } // namespace cricket |
253 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ | 255 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ |
OLD | NEW |