OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
11 #ifndef WEBRTC_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 11 #ifndef WEBRTC_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
12 #define WEBRTC_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 12 #define WEBRTC_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
| 15 #include <set> |
15 #include <string> | 16 #include <string> |
16 #include <vector> | 17 #include <vector> |
17 | 18 |
18 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" |
19 #include "webrtc/base/scoped_ptr.h" | 20 #include "webrtc/base/scoped_ptr.h" |
20 #include "webrtc/base/thread_annotations.h" | 21 #include "webrtc/base/thread_annotations.h" |
21 #include "webrtc/base/thread_checker.h" | 22 #include "webrtc/base/thread_checker.h" |
22 #include "webrtc/media/base/videosinkinterface.h" | 23 #include "webrtc/media/base/videosinkinterface.h" |
| 24 #include "webrtc/media/base/videosourceinterface.h" |
23 #include "webrtc/call.h" | 25 #include "webrtc/call.h" |
24 #include "webrtc/media/base/mediaengine.h" | 26 #include "webrtc/media/base/mediaengine.h" |
25 #include "webrtc/media/webrtc/webrtcvideochannelfactory.h" | 27 #include "webrtc/media/webrtc/webrtcvideochannelfactory.h" |
26 #include "webrtc/media/webrtc/webrtcvideodecoderfactory.h" | 28 #include "webrtc/media/webrtc/webrtcvideodecoderfactory.h" |
27 #include "webrtc/media/webrtc/webrtcvideoencoderfactory.h" | 29 #include "webrtc/media/webrtc/webrtcvideoencoderfactory.h" |
28 #include "webrtc/transport.h" | 30 #include "webrtc/transport.h" |
29 #include "webrtc/video_frame.h" | 31 #include "webrtc/video_frame.h" |
30 #include "webrtc/video_receive_stream.h" | 32 #include "webrtc/video_receive_stream.h" |
31 #include "webrtc/video_renderer.h" | 33 #include "webrtc/video_renderer.h" |
32 #include "webrtc/video_send_stream.h" | 34 #include "webrtc/video_send_stream.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 216 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const |
215 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 217 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
216 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 218 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
217 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 219 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
218 | 220 |
219 static std::string CodecSettingsVectorToString( | 221 static std::string CodecSettingsVectorToString( |
220 const std::vector<VideoCodecSettings>& codecs); | 222 const std::vector<VideoCodecSettings>& codecs); |
221 | 223 |
222 // Wrapper for the sender part, this is where the capturer is connected and | 224 // Wrapper for the sender part, this is where the capturer is connected and |
223 // frames are then converted from cricket frames to webrtc frames. | 225 // frames are then converted from cricket frames to webrtc frames. |
224 class WebRtcVideoSendStream : public sigslot::has_slots<> { | 226 class WebRtcVideoSendStream |
| 227 : public rtc::VideoSinkInterface<cricket::VideoFrame> { |
225 public: | 228 public: |
226 WebRtcVideoSendStream( | 229 WebRtcVideoSendStream( |
227 webrtc::Call* call, | 230 webrtc::Call* call, |
228 const StreamParams& sp, | 231 const StreamParams& sp, |
229 const webrtc::VideoSendStream::Config& config, | 232 const webrtc::VideoSendStream::Config& config, |
230 WebRtcVideoEncoderFactory* external_encoder_factory, | 233 WebRtcVideoEncoderFactory* external_encoder_factory, |
231 const VideoOptions& options, | 234 const VideoOptions& options, |
232 int max_bitrate_bps, | 235 int max_bitrate_bps, |
233 const rtc::Optional<VideoCodecSettings>& codec_settings, | 236 const rtc::Optional<VideoCodecSettings>& codec_settings, |
234 const std::vector<webrtc::RtpExtension>& rtp_extensions, | 237 const std::vector<webrtc::RtpExtension>& rtp_extensions, |
235 const VideoSendParameters& send_params); | 238 const VideoSendParameters& send_params); |
236 ~WebRtcVideoSendStream(); | 239 virtual ~WebRtcVideoSendStream(); |
237 | 240 |
238 void SetOptions(const VideoOptions& options); | 241 void SetOptions(const VideoOptions& options); |
239 // TODO(pbos): Move logic from SetOptions into this method. | 242 // TODO(pbos): Move logic from SetOptions into this method. |
240 void SetSendParameters(const ChangedSendParameters& send_params); | 243 void SetSendParameters(const ChangedSendParameters& send_params); |
241 | 244 |
242 void InputFrame(VideoCapturer* capturer, const VideoFrame* frame); | 245 void OnFrame(const cricket::VideoFrame& frame) override; |
243 bool SetCapturer(VideoCapturer* capturer); | 246 bool SetCapturer(VideoCapturer* capturer); |
244 void MuteStream(bool mute); | 247 void MuteStream(bool mute); |
245 bool DisconnectCapturer(); | 248 bool DisconnectCapturer(); |
246 | 249 |
247 void Start(); | 250 void Start(); |
248 void Stop(); | 251 void Stop(); |
249 | 252 |
250 const std::vector<uint32_t>& GetSsrcs() const; | 253 const std::vector<uint32_t>& GetSsrcs() const; |
251 VideoSenderInfo GetVideoSenderInfo(); | 254 VideoSenderInfo GetVideoSenderInfo(); |
252 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); | 255 void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); | 331 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); |
329 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( | 332 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( |
330 const Dimensions& dimensions, | 333 const Dimensions& dimensions, |
331 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); | 334 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); |
332 void SetDimensions(int width, int height, bool is_screencast) | 335 void SetDimensions(int width, int height, bool is_screencast) |
333 EXCLUSIVE_LOCKS_REQUIRED(lock_); | 336 EXCLUSIVE_LOCKS_REQUIRED(lock_); |
334 | 337 |
335 const std::vector<uint32_t> ssrcs_; | 338 const std::vector<uint32_t> ssrcs_; |
336 const std::vector<SsrcGroup> ssrc_groups_; | 339 const std::vector<SsrcGroup> ssrc_groups_; |
337 webrtc::Call* const call_; | 340 webrtc::Call* const call_; |
| 341 rtc::VideoSinkWants sink_wants_; |
338 WebRtcVideoEncoderFactory* const external_encoder_factory_ | 342 WebRtcVideoEncoderFactory* const external_encoder_factory_ |
339 GUARDED_BY(lock_); | 343 GUARDED_BY(lock_); |
340 | 344 |
341 rtc::CriticalSection lock_; | 345 rtc::CriticalSection lock_; |
342 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); | 346 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_); |
343 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); | 347 VideoSendStreamParameters parameters_ GUARDED_BY(lock_); |
344 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); | 348 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); |
345 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); | 349 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); |
346 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); | 350 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); |
347 Dimensions last_dimensions_ GUARDED_BY(lock_); | 351 Dimensions last_dimensions_ GUARDED_BY(lock_); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 VideoOptions options_; | 508 VideoOptions options_; |
505 // TODO(deadbeef): Don't duplicate information between | 509 // TODO(deadbeef): Don't duplicate information between |
506 // send_params/recv_params, rtp_extensions, options, etc. | 510 // send_params/recv_params, rtp_extensions, options, etc. |
507 VideoSendParameters send_params_; | 511 VideoSendParameters send_params_; |
508 VideoRecvParameters recv_params_; | 512 VideoRecvParameters recv_params_; |
509 }; | 513 }; |
510 | 514 |
511 } // namespace cricket | 515 } // namespace cricket |
512 | 516 |
513 #endif // WEBRTC_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 517 #endif // WEBRTC_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |