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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 rtc::scoped_ptr<WebRtcVideoEncoderFactory> simulcast_encoder_factory_; | 154 rtc::scoped_ptr<WebRtcVideoEncoderFactory> simulcast_encoder_factory_; |
155 }; | 155 }; |
156 | 156 |
157 class WebRtcVideoChannel2 : public rtc::MessageHandler, | 157 class WebRtcVideoChannel2 : public rtc::MessageHandler, |
158 public VideoMediaChannel, | 158 public VideoMediaChannel, |
159 public webrtc::newapi::Transport, | 159 public webrtc::newapi::Transport, |
160 public webrtc::LoadObserver { | 160 public webrtc::LoadObserver { |
161 public: | 161 public: |
162 WebRtcVideoChannel2(webrtc::Call* call, | 162 WebRtcVideoChannel2(webrtc::Call* call, |
163 const VideoOptions& options, | 163 const VideoOptions& options, |
| 164 const std::vector<VideoCodec>& recv_codecs, |
164 WebRtcVideoEncoderFactory* external_encoder_factory, | 165 WebRtcVideoEncoderFactory* external_encoder_factory, |
165 WebRtcVideoDecoderFactory* external_decoder_factory); | 166 WebRtcVideoDecoderFactory* external_decoder_factory); |
166 ~WebRtcVideoChannel2() override; | 167 ~WebRtcVideoChannel2() override; |
167 | 168 |
168 // VideoMediaChannel implementation | 169 // VideoMediaChannel implementation |
169 bool SetSendParameters(const VideoSendParameters& params) override; | 170 bool SetSendParameters(const VideoSendParameters& params) override; |
170 bool SetRecvParameters(const VideoRecvParameters& params) override; | 171 bool SetRecvParameters(const VideoRecvParameters& params) override; |
171 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) override; | |
172 bool SetSendCodecs(const std::vector<VideoCodec>& codecs) override; | |
173 bool GetSendCodec(VideoCodec* send_codec) override; | 172 bool GetSendCodec(VideoCodec* send_codec) override; |
174 bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) override; | 173 bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format) override; |
175 bool SetRender(bool render) override; | 174 bool SetRender(bool render) override; |
176 bool SetSend(bool send) override; | 175 bool SetSend(bool send) override; |
177 bool SetVideoSend(uint32 ssrc, bool mute, | 176 bool SetVideoSend(uint32 ssrc, bool mute, |
178 const VideoOptions* options) override; | 177 const VideoOptions* options) override; |
179 bool AddSendStream(const StreamParams& sp) override; | 178 bool AddSendStream(const StreamParams& sp) override; |
180 bool RemoveSendStream(uint32 ssrc) override; | 179 bool RemoveSendStream(uint32 ssrc) override; |
181 bool AddRecvStream(const StreamParams& sp) override; | 180 bool AddRecvStream(const StreamParams& sp) override; |
182 bool AddRecvStream(const StreamParams& sp, bool default_stream); | 181 bool AddRecvStream(const StreamParams& sp, bool default_stream); |
183 bool RemoveRecvStream(uint32 ssrc) override; | 182 bool RemoveRecvStream(uint32 ssrc) override; |
184 bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) override; | 183 bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) override; |
185 bool GetStats(VideoMediaInfo* info) override; | 184 bool GetStats(VideoMediaInfo* info) override; |
186 bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) override; | 185 bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) override; |
187 bool SendIntraFrame() override; | 186 bool SendIntraFrame() override; |
188 bool RequestIntraFrame() override; | 187 bool RequestIntraFrame() override; |
189 | 188 |
190 void OnPacketReceived(rtc::Buffer* packet, | 189 void OnPacketReceived(rtc::Buffer* packet, |
191 const rtc::PacketTime& packet_time) override; | 190 const rtc::PacketTime& packet_time) override; |
192 void OnRtcpReceived(rtc::Buffer* packet, | 191 void OnRtcpReceived(rtc::Buffer* packet, |
193 const rtc::PacketTime& packet_time) override; | 192 const rtc::PacketTime& packet_time) override; |
194 void OnReadyToSend(bool ready) override; | 193 void OnReadyToSend(bool ready) override; |
195 | |
196 // Set send/receive RTP header extensions. This must be done before creating | |
197 // streams as it only has effect on future streams. | |
198 bool SetRecvRtpHeaderExtensions( | |
199 const std::vector<RtpHeaderExtension>& extensions) override; | |
200 bool SetSendRtpHeaderExtensions( | |
201 const std::vector<RtpHeaderExtension>& extensions) override; | |
202 bool SetMaxSendBandwidth(int bps) override; | |
203 bool SetOptions(const VideoOptions& options) override; | |
204 void SetInterface(NetworkInterface* iface) override; | 194 void SetInterface(NetworkInterface* iface) override; |
205 void UpdateAspectRatio(int ratio_w, int ratio_h) override; | 195 void UpdateAspectRatio(int ratio_w, int ratio_h) override; |
206 | 196 |
207 void OnMessage(rtc::Message* msg) override; | 197 void OnMessage(rtc::Message* msg) override; |
208 | 198 |
209 void OnLoadUpdate(Load load) override; | 199 void OnLoadUpdate(Load load) override; |
210 | 200 |
211 // Implemented for VideoMediaChannelTest. | 201 // Implemented for VideoMediaChannelTest. |
212 bool sending() const { return sending_; } | 202 bool sending() const { return sending_; } |
213 uint32 GetDefaultSendChannelSsrc() { return default_send_ssrc_; } | 203 uint32 GetDefaultSendChannelSsrc() { return default_send_ssrc_; } |
214 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer); | 204 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer); |
215 | 205 |
216 private: | 206 private: |
217 bool MuteStream(uint32 ssrc, bool mute); | 207 bool MuteStream(uint32 ssrc, bool mute); |
218 class WebRtcVideoReceiveStream; | 208 class WebRtcVideoReceiveStream; |
| 209 |
| 210 bool SetSendCodecs(const std::vector<VideoCodec>& codecs); |
| 211 bool SetSendRtpHeaderExtensions( |
| 212 const std::vector<RtpHeaderExtension>& extensions); |
| 213 bool SetMaxSendBandwidth(int bps); |
| 214 bool SetOptions(const VideoOptions& options); |
| 215 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); |
| 216 bool SetRecvRtpHeaderExtensions( |
| 217 const std::vector<RtpHeaderExtension>& extensions); |
| 218 |
219 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, | 219 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, |
220 const StreamParams& sp) const; | 220 const StreamParams& sp) const; |
221 bool CodecIsExternallySupported(const std::string& name) const; | 221 bool CodecIsExternallySupported(const std::string& name) const; |
222 bool ValidateSendSsrcAvailability(const StreamParams& sp) const | 222 bool ValidateSendSsrcAvailability(const StreamParams& sp) const |
223 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 223 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
224 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 224 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const |
225 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 225 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
226 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 226 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
227 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 227 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
228 | 228 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 518 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
519 std::vector<VideoCodecSettings> recv_codecs_; | 519 std::vector<VideoCodecSettings> recv_codecs_; |
520 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 520 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
521 webrtc::Call::Config::BitrateConfig bitrate_config_; | 521 webrtc::Call::Config::BitrateConfig bitrate_config_; |
522 VideoOptions options_; | 522 VideoOptions options_; |
523 }; | 523 }; |
524 | 524 |
525 } // namespace cricket | 525 } // namespace cricket |
526 | 526 |
527 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 527 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |