OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 class WebRtcVideoChannel2 : public rtc::MessageHandler, | 172 class WebRtcVideoChannel2 : public rtc::MessageHandler, |
173 public VideoMediaChannel, | 173 public VideoMediaChannel, |
174 public webrtc::newapi::Transport, | 174 public webrtc::newapi::Transport, |
175 public webrtc::LoadObserver { | 175 public webrtc::LoadObserver { |
176 public: | 176 public: |
177 WebRtcVideoChannel2(WebRtcCallFactory* call_factory, | 177 WebRtcVideoChannel2(WebRtcCallFactory* call_factory, |
178 WebRtcVoiceEngine* voice_engine, | 178 WebRtcVoiceEngine* voice_engine, |
179 WebRtcVoiceMediaChannel* voice_channel, | 179 WebRtcVoiceMediaChannel* voice_channel, |
180 const VideoOptions& options, | 180 const VideoOptions& options, |
| 181 const std::vector<VideoCodec>& recv_codecs, |
181 WebRtcVideoEncoderFactory* external_encoder_factory, | 182 WebRtcVideoEncoderFactory* external_encoder_factory, |
182 WebRtcVideoDecoderFactory* external_decoder_factory); | 183 WebRtcVideoDecoderFactory* external_decoder_factory); |
183 ~WebRtcVideoChannel2(); | 184 ~WebRtcVideoChannel2(); |
184 bool Init(); | |
185 | 185 |
186 // VideoMediaChannel implementation | 186 // VideoMediaChannel implementation |
187 void DetachVoiceChannel() override; | 187 void DetachVoiceChannel() override; |
188 bool SetSendParameters(const VideoSendParameters& params) override; | 188 bool SetSendParameters(const VideoSendParameters& params) override; |
189 bool SetRecvParameters(const VideoRecvParameters& params) override; | 189 bool SetRecvParameters(const VideoRecvParameters& params) override; |
190 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) override; | |
191 bool SetSendCodecs(const std::vector<VideoCodec>& codecs) override; | |
192 bool GetSendCodec(VideoCodec* send_codec) override; | 190 bool GetSendCodec(VideoCodec* send_codec) override; |
193 bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) override; | 191 bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) override; |
194 bool SetRender(bool render) override; | 192 bool SetRender(bool render) override; |
195 bool SetSend(bool send) override; | 193 bool SetSend(bool send) override; |
196 bool SetVideoSend(uint32 ssrc, bool mute, | 194 bool SetVideoSend(uint32 ssrc, bool mute, |
197 const VideoOptions* options) override; | 195 const VideoOptions* options) override; |
198 bool AddSendStream(const StreamParams& sp) override; | 196 bool AddSendStream(const StreamParams& sp) override; |
199 bool RemoveSendStream(uint32 ssrc) override; | 197 bool RemoveSendStream(uint32 ssrc) override; |
200 bool AddRecvStream(const StreamParams& sp) override; | 198 bool AddRecvStream(const StreamParams& sp) override; |
201 bool AddRecvStream(const StreamParams& sp, bool default_stream); | 199 bool AddRecvStream(const StreamParams& sp, bool default_stream); |
202 bool RemoveRecvStream(uint32 ssrc) override; | 200 bool RemoveRecvStream(uint32 ssrc) override; |
203 bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) override; | 201 bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) override; |
204 bool GetStats(VideoMediaInfo* info) override; | 202 bool GetStats(VideoMediaInfo* info) override; |
205 bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) override; | 203 bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) override; |
206 bool SendIntraFrame() override; | 204 bool SendIntraFrame() override; |
207 bool RequestIntraFrame() override; | 205 bool RequestIntraFrame() override; |
208 | 206 |
209 void OnPacketReceived(rtc::Buffer* packet, | 207 void OnPacketReceived(rtc::Buffer* packet, |
210 const rtc::PacketTime& packet_time) override; | 208 const rtc::PacketTime& packet_time) override; |
211 void OnRtcpReceived(rtc::Buffer* packet, | 209 void OnRtcpReceived(rtc::Buffer* packet, |
212 const rtc::PacketTime& packet_time) override; | 210 const rtc::PacketTime& packet_time) override; |
213 void OnReadyToSend(bool ready) override; | 211 void OnReadyToSend(bool ready) override; |
214 | |
215 // Set send/receive RTP header extensions. This must be done before creating | |
216 // streams as it only has effect on future streams. | |
217 bool SetRecvRtpHeaderExtensions( | |
218 const std::vector<RtpHeaderExtension>& extensions) override; | |
219 bool SetSendRtpHeaderExtensions( | |
220 const std::vector<RtpHeaderExtension>& extensions) override; | |
221 bool SetMaxSendBandwidth(int bps) override; | |
222 bool SetOptions(const VideoOptions& options) override; | |
223 void SetInterface(NetworkInterface* iface) override; | 212 void SetInterface(NetworkInterface* iface) override; |
224 void UpdateAspectRatio(int ratio_w, int ratio_h) override; | 213 void UpdateAspectRatio(int ratio_w, int ratio_h) override; |
225 | 214 |
226 void OnMessage(rtc::Message* msg) override; | 215 void OnMessage(rtc::Message* msg) override; |
227 | 216 |
228 void OnLoadUpdate(Load load) override; | 217 void OnLoadUpdate(Load load) override; |
229 | 218 |
230 // Implemented for VideoMediaChannelTest. | 219 // Implemented for VideoMediaChannelTest. |
231 bool sending() const { return sending_; } | 220 bool sending() const { return sending_; } |
232 uint32 GetDefaultSendChannelSsrc() { return default_send_ssrc_; } | 221 uint32 GetDefaultSendChannelSsrc() { return default_send_ssrc_; } |
233 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer); | 222 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer); |
234 | 223 |
235 private: | 224 private: |
236 bool MuteStream(uint32 ssrc, bool mute); | 225 bool MuteStream(uint32 ssrc, bool mute); |
237 class WebRtcVideoReceiveStream; | 226 class WebRtcVideoReceiveStream; |
| 227 |
| 228 bool SetSendCodecs(const std::vector<VideoCodec>& codecs); |
| 229 bool SetSendRtpHeaderExtensions( |
| 230 const std::vector<RtpHeaderExtension>& extensions); |
| 231 bool SetMaxSendBandwidth(int bps); |
| 232 bool SetOptions(const VideoOptions& options); |
| 233 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); |
| 234 bool SetRecvRtpHeaderExtensions( |
| 235 const std::vector<RtpHeaderExtension>& extensions); |
| 236 |
238 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, | 237 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, |
239 const StreamParams& sp) const; | 238 const StreamParams& sp) const; |
240 bool CodecIsExternallySupported(const std::string& name) const; | 239 bool CodecIsExternallySupported(const std::string& name) const; |
241 bool ValidateSendSsrcAvailability(const StreamParams& sp) const | 240 bool ValidateSendSsrcAvailability(const StreamParams& sp) const |
242 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 241 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
243 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 242 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const |
244 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 243 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
245 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 244 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
246 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 245 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
247 | 246 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 539 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
541 std::vector<VideoCodecSettings> recv_codecs_; | 540 std::vector<VideoCodecSettings> recv_codecs_; |
542 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 541 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
543 webrtc::Call::Config::BitrateConfig bitrate_config_; | 542 webrtc::Call::Config::BitrateConfig bitrate_config_; |
544 VideoOptions options_; | 543 VideoOptions options_; |
545 }; | 544 }; |
546 | 545 |
547 } // namespace cricket | 546 } // namespace cricket |
548 | 547 |
549 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 548 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |