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 29 matching lines...) Expand all Loading... |
40 #include <vector> | 40 #include <vector> |
41 | 41 |
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 | 50 class FakeAudioSendStream final : public webrtc::AudioSendStream { |
51 class FakeAudioSendStream : public webrtc::AudioSendStream { | |
52 public: | 51 public: |
53 explicit FakeAudioSendStream( | 52 explicit FakeAudioSendStream(const webrtc::AudioSendStream::Config& config); |
54 const webrtc::AudioSendStream::Config& config); | |
55 | 53 |
56 const webrtc::AudioSendStream::Config& GetConfig() const; | 54 const webrtc::AudioSendStream::Config& GetConfig() const; |
57 void SetStats(const webrtc::AudioSendStream::Stats& stats); | 55 void SetStats(const webrtc::AudioSendStream::Stats& stats); |
58 | 56 |
59 private: | 57 private: |
60 // webrtc::SendStream implementation. | 58 // webrtc::SendStream implementation. |
61 void Start() override {} | 59 void Start() override {} |
62 void Stop() override {} | 60 void Stop() override {} |
63 void SignalNetworkState(webrtc::NetworkState state) override {} | 61 void SignalNetworkState(webrtc::NetworkState state) override {} |
64 bool DeliverRtcp(const uint8_t* packet, size_t length) override { | 62 bool DeliverRtcp(const uint8_t* packet, size_t length) override { |
65 return true; | 63 return true; |
66 } | 64 } |
67 | 65 |
68 // webrtc::AudioSendStream implementation. | 66 // webrtc::AudioSendStream implementation. |
69 webrtc::AudioSendStream::Stats GetStats() const override; | 67 webrtc::AudioSendStream::Stats GetStats() const override; |
70 | 68 |
71 webrtc::AudioSendStream::Config config_; | 69 webrtc::AudioSendStream::Config config_; |
72 webrtc::AudioSendStream::Stats stats_; | 70 webrtc::AudioSendStream::Stats stats_; |
73 }; | 71 }; |
74 | 72 |
75 class FakeAudioReceiveStream : public webrtc::AudioReceiveStream { | 73 class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { |
76 public: | 74 public: |
77 explicit FakeAudioReceiveStream( | 75 explicit FakeAudioReceiveStream( |
78 const webrtc::AudioReceiveStream::Config& config); | 76 const webrtc::AudioReceiveStream::Config& config); |
79 | 77 |
80 const webrtc::AudioReceiveStream::Config& GetConfig() const; | 78 const webrtc::AudioReceiveStream::Config& GetConfig() const; |
81 void SetStats(const webrtc::AudioReceiveStream::Stats& stats); | 79 void SetStats(const webrtc::AudioReceiveStream::Stats& stats); |
82 int received_packets() const { return received_packets_; } | 80 int received_packets() const { return received_packets_; } |
83 void IncrementReceivedPackets(); | 81 void IncrementReceivedPackets(); |
84 | 82 |
85 private: | 83 private: |
(...skipping 11 matching lines...) Expand all Loading... |
97 } | 95 } |
98 | 96 |
99 // webrtc::AudioReceiveStream implementation. | 97 // webrtc::AudioReceiveStream implementation. |
100 webrtc::AudioReceiveStream::Stats GetStats() const override; | 98 webrtc::AudioReceiveStream::Stats GetStats() const override; |
101 | 99 |
102 webrtc::AudioReceiveStream::Config config_; | 100 webrtc::AudioReceiveStream::Config config_; |
103 webrtc::AudioReceiveStream::Stats stats_; | 101 webrtc::AudioReceiveStream::Stats stats_; |
104 int received_packets_; | 102 int received_packets_; |
105 }; | 103 }; |
106 | 104 |
107 class FakeVideoSendStream : public webrtc::VideoSendStream, | 105 class FakeVideoSendStream final : public webrtc::VideoSendStream, |
108 public webrtc::VideoCaptureInput { | 106 public webrtc::VideoCaptureInput { |
109 public: | 107 public: |
110 FakeVideoSendStream(const webrtc::VideoSendStream::Config& config, | 108 FakeVideoSendStream(const webrtc::VideoSendStream::Config& config, |
111 const webrtc::VideoEncoderConfig& encoder_config); | 109 const webrtc::VideoEncoderConfig& encoder_config); |
112 webrtc::VideoSendStream::Config GetConfig() const; | 110 webrtc::VideoSendStream::Config GetConfig() const; |
113 webrtc::VideoEncoderConfig GetEncoderConfig() const; | 111 webrtc::VideoEncoderConfig GetEncoderConfig() const; |
114 std::vector<webrtc::VideoStream> GetVideoStreams(); | 112 std::vector<webrtc::VideoStream> GetVideoStreams(); |
115 | 113 |
116 bool IsSending() const; | 114 bool IsSending() const; |
117 bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const; | 115 bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const; |
118 bool GetVp9Settings(webrtc::VideoCodecVP9* settings) const; | 116 bool GetVp9Settings(webrtc::VideoCodecVP9* settings) const; |
(...skipping 27 matching lines...) Expand all Loading... |
146 bool codec_settings_set_; | 144 bool codec_settings_set_; |
147 union VpxSettings { | 145 union VpxSettings { |
148 webrtc::VideoCodecVP8 vp8; | 146 webrtc::VideoCodecVP8 vp8; |
149 webrtc::VideoCodecVP9 vp9; | 147 webrtc::VideoCodecVP9 vp9; |
150 } vpx_settings_; | 148 } vpx_settings_; |
151 int num_swapped_frames_; | 149 int num_swapped_frames_; |
152 webrtc::VideoFrame last_frame_; | 150 webrtc::VideoFrame last_frame_; |
153 webrtc::VideoSendStream::Stats stats_; | 151 webrtc::VideoSendStream::Stats stats_; |
154 }; | 152 }; |
155 | 153 |
156 class FakeVideoReceiveStream : public webrtc::VideoReceiveStream { | 154 class FakeVideoReceiveStream final : public webrtc::VideoReceiveStream { |
157 public: | 155 public: |
158 explicit FakeVideoReceiveStream( | 156 explicit FakeVideoReceiveStream( |
159 const webrtc::VideoReceiveStream::Config& config); | 157 const webrtc::VideoReceiveStream::Config& config); |
160 | 158 |
161 webrtc::VideoReceiveStream::Config GetConfig(); | 159 webrtc::VideoReceiveStream::Config GetConfig(); |
162 | 160 |
163 bool IsReceiving() const; | 161 bool IsReceiving() const; |
164 | 162 |
165 void InjectFrame(const webrtc::VideoFrame& frame, int time_to_render_ms); | 163 void InjectFrame(const webrtc::VideoFrame& frame, int time_to_render_ms); |
166 | 164 |
(...skipping 14 matching lines...) Expand all Loading... |
181 } | 179 } |
182 | 180 |
183 // webrtc::VideoReceiveStream implementation. | 181 // webrtc::VideoReceiveStream implementation. |
184 webrtc::VideoReceiveStream::Stats GetStats() const override; | 182 webrtc::VideoReceiveStream::Stats GetStats() const override; |
185 | 183 |
186 webrtc::VideoReceiveStream::Config config_; | 184 webrtc::VideoReceiveStream::Config config_; |
187 bool receiving_; | 185 bool receiving_; |
188 webrtc::VideoReceiveStream::Stats stats_; | 186 webrtc::VideoReceiveStream::Stats stats_; |
189 }; | 187 }; |
190 | 188 |
191 class FakeCall : public webrtc::Call, public webrtc::PacketReceiver { | 189 class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver { |
192 public: | 190 public: |
193 explicit FakeCall(const webrtc::Call::Config& config); | 191 explicit FakeCall(const webrtc::Call::Config& config); |
194 ~FakeCall() override; | 192 ~FakeCall() override; |
195 | 193 |
196 webrtc::Call::Config GetConfig() const; | 194 webrtc::Call::Config GetConfig() const; |
197 const std::vector<FakeVideoSendStream*>& GetVideoSendStreams(); | 195 const std::vector<FakeVideoSendStream*>& GetVideoSendStreams(); |
198 const std::vector<FakeVideoReceiveStream*>& GetVideoReceiveStreams(); | 196 const std::vector<FakeVideoReceiveStream*>& GetVideoReceiveStreams(); |
199 | 197 |
200 const std::vector<FakeAudioSendStream*>& GetAudioSendStreams(); | 198 const std::vector<FakeAudioSendStream*>& GetAudioSendStreams(); |
201 const FakeAudioSendStream* GetAudioSendStream(uint32_t ssrc); | 199 const FakeAudioSendStream* GetAudioSendStream(uint32_t ssrc); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 std::vector<FakeAudioSendStream*> audio_send_streams_; | 247 std::vector<FakeAudioSendStream*> audio_send_streams_; |
250 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 248 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
251 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 249 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
252 | 250 |
253 int num_created_send_streams_; | 251 int num_created_send_streams_; |
254 int num_created_receive_streams_; | 252 int num_created_receive_streams_; |
255 }; | 253 }; |
256 | 254 |
257 } // namespace cricket | 255 } // namespace cricket |
258 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ | 256 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ |
OLD | NEW |