OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "webrtc/call.h" | 42 #include "webrtc/call.h" |
43 #include "webrtc/audio_receive_stream.h" | 43 #include "webrtc/audio_receive_stream.h" |
44 #include "webrtc/audio_send_stream.h" | 44 #include "webrtc/audio_send_stream.h" |
45 #include "webrtc/video_frame.h" | 45 #include "webrtc/video_frame.h" |
46 #include "webrtc/video_receive_stream.h" | 46 #include "webrtc/video_receive_stream.h" |
47 #include "webrtc/video_send_stream.h" | 47 #include "webrtc/video_send_stream.h" |
48 | 48 |
49 namespace cricket { | 49 namespace cricket { |
50 class FakeAudioSendStream final : public webrtc::AudioSendStream { | 50 class FakeAudioSendStream final : public webrtc::AudioSendStream { |
51 public: | 51 public: |
| 52 struct TelephoneEvent { |
| 53 int payload_type = -1; |
| 54 uint8_t event_code = 0; |
| 55 uint32_t duration_ms = 0; |
| 56 }; |
| 57 |
52 explicit FakeAudioSendStream(const webrtc::AudioSendStream::Config& config); | 58 explicit FakeAudioSendStream(const webrtc::AudioSendStream::Config& config); |
53 | 59 |
54 const webrtc::AudioSendStream::Config& GetConfig() const; | 60 const webrtc::AudioSendStream::Config& GetConfig() const; |
55 void SetStats(const webrtc::AudioSendStream::Stats& stats); | 61 void SetStats(const webrtc::AudioSendStream::Stats& stats); |
| 62 TelephoneEvent GetLatestTelephoneEvent() const; |
56 | 63 |
57 private: | 64 private: |
58 // webrtc::SendStream implementation. | 65 // webrtc::SendStream implementation. |
59 void Start() override {} | 66 void Start() override {} |
60 void Stop() override {} | 67 void Stop() override {} |
61 void SignalNetworkState(webrtc::NetworkState state) override {} | 68 void SignalNetworkState(webrtc::NetworkState state) override {} |
62 bool DeliverRtcp(const uint8_t* packet, size_t length) override { | 69 bool DeliverRtcp(const uint8_t* packet, size_t length) override { |
63 return true; | 70 return true; |
64 } | 71 } |
65 | 72 |
66 // webrtc::AudioSendStream implementation. | 73 // webrtc::AudioSendStream implementation. |
| 74 bool SendTelephoneEvent(int payload_type, uint8_t event, |
| 75 uint32_t duration_ms) override; |
67 webrtc::AudioSendStream::Stats GetStats() const override; | 76 webrtc::AudioSendStream::Stats GetStats() const override; |
68 | 77 |
| 78 TelephoneEvent latest_telephone_event_; |
69 webrtc::AudioSendStream::Config config_; | 79 webrtc::AudioSendStream::Config config_; |
70 webrtc::AudioSendStream::Stats stats_; | 80 webrtc::AudioSendStream::Stats stats_; |
71 }; | 81 }; |
72 | 82 |
73 class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { | 83 class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { |
74 public: | 84 public: |
75 explicit FakeAudioReceiveStream( | 85 explicit FakeAudioReceiveStream( |
76 const webrtc::AudioReceiveStream::Config& config); | 86 const webrtc::AudioReceiveStream::Config& config); |
77 | 87 |
78 const webrtc::AudioReceiveStream::Config& GetConfig() const; | 88 const webrtc::AudioReceiveStream::Config& GetConfig() const; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 std::vector<FakeAudioSendStream*> audio_send_streams_; | 257 std::vector<FakeAudioSendStream*> audio_send_streams_; |
248 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 258 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
249 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 259 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
250 | 260 |
251 int num_created_send_streams_; | 261 int num_created_send_streams_; |
252 int num_created_receive_streams_; | 262 int num_created_receive_streams_; |
253 }; | 263 }; |
254 | 264 |
255 } // namespace cricket | 265 } // namespace cricket |
256 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ | 266 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ |
OLD | NEW |