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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } | 195 uint32_t GetDefaultSendChannelSsrc() { return default_send_ssrc_; } |
196 | 196 |
197 private: | 197 private: |
198 bool MuteStream(uint32_t ssrc, bool mute); | 198 bool MuteStream(uint32_t ssrc, bool mute); |
199 class WebRtcVideoReceiveStream; | 199 class WebRtcVideoReceiveStream; |
200 | 200 |
201 bool SetSendCodecs(const std::vector<VideoCodec>& codecs); | 201 bool SetSendCodecs(const std::vector<VideoCodec>& codecs); |
202 bool SetSendRtpHeaderExtensions( | 202 bool SetSendRtpHeaderExtensions( |
203 const std::vector<RtpHeaderExtension>& extensions); | 203 const std::vector<RtpHeaderExtension>& extensions); |
204 bool SetMaxSendBandwidth(int bps); | 204 bool SetMaxSendBandwidth(int bps); |
205 bool SetOptions(const VideoOptions& options); | 205 void SetSharedOptions(const VideoOptions& options); |
| 206 bool SetOptions(uint32_t ssrc, const VideoOptions& options); |
206 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); | 207 bool SetRecvCodecs(const std::vector<VideoCodec>& codecs); |
207 bool SetRecvRtpHeaderExtensions( | 208 bool SetRecvRtpHeaderExtensions( |
208 const std::vector<RtpHeaderExtension>& extensions); | 209 const std::vector<RtpHeaderExtension>& extensions); |
209 | 210 |
210 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, | 211 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, |
211 const StreamParams& sp) const; | 212 const StreamParams& sp) const; |
212 bool CodecIsExternallySupported(const std::string& name) const; | 213 bool CodecIsExternallySupported(const std::string& name) const; |
213 bool ValidateSendSsrcAvailability(const StreamParams& sp) const | 214 bool ValidateSendSsrcAvailability(const StreamParams& sp) const |
214 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 215 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
215 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 216 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const |
(...skipping 17 matching lines...) Expand all Loading... |
233 | 234 |
234 // Wrapper for the sender part, this is where the capturer is connected and | 235 // Wrapper for the sender part, this is where the capturer is connected and |
235 // frames are then converted from cricket frames to webrtc frames. | 236 // frames are then converted from cricket frames to webrtc frames. |
236 class WebRtcVideoSendStream : public sigslot::has_slots<> { | 237 class WebRtcVideoSendStream : public sigslot::has_slots<> { |
237 public: | 238 public: |
238 WebRtcVideoSendStream( | 239 WebRtcVideoSendStream( |
239 webrtc::Call* call, | 240 webrtc::Call* call, |
240 const StreamParams& sp, | 241 const StreamParams& sp, |
241 const webrtc::VideoSendStream::Config& config, | 242 const webrtc::VideoSendStream::Config& config, |
242 WebRtcVideoEncoderFactory* external_encoder_factory, | 243 WebRtcVideoEncoderFactory* external_encoder_factory, |
243 const VideoOptions& options, | |
244 int max_bitrate_bps, | 244 int max_bitrate_bps, |
245 const rtc::Optional<VideoCodecSettings>& codec_settings, | 245 const rtc::Optional<VideoCodecSettings>& codec_settings, |
246 const std::vector<webrtc::RtpExtension>& rtp_extensions, | 246 const std::vector<webrtc::RtpExtension>& rtp_extensions, |
247 const VideoSendParameters& send_params); | 247 const VideoSendParameters& send_params); |
248 ~WebRtcVideoSendStream(); | 248 ~WebRtcVideoSendStream(); |
249 | 249 |
250 void SetOptions(const VideoOptions& options); | 250 void SetOptions(const VideoOptions& options); |
251 void SetCodec(const VideoCodecSettings& codec); | 251 void SetCodec(const VideoCodecSettings& codec); |
252 void SetRtpExtensions( | 252 void SetRtpExtensions( |
253 const std::vector<webrtc::RtpExtension>& rtp_extensions); | 253 const std::vector<webrtc::RtpExtension>& rtp_extensions); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 // the stream has been running. | 459 // the stream has been running. |
460 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ | 460 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ |
461 GUARDED_BY(renderer_lock_); | 461 GUARDED_BY(renderer_lock_); |
462 int64_t first_frame_timestamp_ GUARDED_BY(renderer_lock_); | 462 int64_t first_frame_timestamp_ GUARDED_BY(renderer_lock_); |
463 // Start NTP time is estimated as current remote NTP time (estimated from | 463 // Start NTP time is estimated as current remote NTP time (estimated from |
464 // RTCP) minus the elapsed time, as soon as remote NTP time is available. | 464 // RTCP) minus the elapsed time, as soon as remote NTP time is available. |
465 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(renderer_lock_); | 465 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(renderer_lock_); |
466 }; | 466 }; |
467 | 467 |
468 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); | 468 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); |
469 void SetDefaultOptions(); | |
470 | 469 |
471 bool SendRtp(const uint8_t* data, | 470 bool SendRtp(const uint8_t* data, |
472 size_t len, | 471 size_t len, |
473 const webrtc::PacketOptions& options) override; | 472 const webrtc::PacketOptions& options) override; |
474 bool SendRtcp(const uint8_t* data, size_t len) override; | 473 bool SendRtcp(const uint8_t* data, size_t len) override; |
475 | 474 |
476 void StartAllSendStreams(); | 475 void StartAllSendStreams(); |
477 void StopAllSendStreams(); | 476 void StopAllSendStreams(); |
478 | 477 |
479 static std::vector<VideoCodecSettings> MapCodecs( | 478 static std::vector<VideoCodecSettings> MapCodecs( |
(...skipping 18 matching lines...) Expand all Loading... |
498 | 497 |
499 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; | 498 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; |
500 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; | 499 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; |
501 | 500 |
502 // Separate list of set capturers used to signal CPU adaptation. These should | 501 // Separate list of set capturers used to signal CPU adaptation. These should |
503 // not be locked while calling methods that take other locks to prevent | 502 // not be locked while calling methods that take other locks to prevent |
504 // lock-order inversions. | 503 // lock-order inversions. |
505 rtc::CriticalSection capturer_crit_; | 504 rtc::CriticalSection capturer_crit_; |
506 bool signal_cpu_adaptation_ GUARDED_BY(capturer_crit_); | 505 bool signal_cpu_adaptation_ GUARDED_BY(capturer_crit_); |
507 std::map<uint32_t, VideoCapturer*> capturers_ GUARDED_BY(capturer_crit_); | 506 std::map<uint32_t, VideoCapturer*> capturers_ GUARDED_BY(capturer_crit_); |
| 507 bool disable_prerenderer_smoothing_; |
508 | 508 |
509 rtc::CriticalSection stream_crit_; | 509 rtc::CriticalSection stream_crit_; |
510 // Using primary-ssrc (first ssrc) as key. | 510 // Using primary-ssrc (first ssrc) as key. |
511 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ | 511 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ |
512 GUARDED_BY(stream_crit_); | 512 GUARDED_BY(stream_crit_); |
513 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_ | 513 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_ |
514 GUARDED_BY(stream_crit_); | 514 GUARDED_BY(stream_crit_); |
515 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_); | 515 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_); |
516 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_); | 516 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_); |
517 | 517 |
518 rtc::Optional<VideoCodecSettings> send_codec_; | 518 rtc::Optional<VideoCodecSettings> send_codec_; |
519 std::vector<webrtc::RtpExtension> send_rtp_extensions_; | 519 std::vector<webrtc::RtpExtension> send_rtp_extensions_; |
520 | 520 |
521 WebRtcVideoEncoderFactory* const external_encoder_factory_; | 521 WebRtcVideoEncoderFactory* const external_encoder_factory_; |
522 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 522 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
523 std::vector<VideoCodecSettings> recv_codecs_; | 523 std::vector<VideoCodecSettings> recv_codecs_; |
524 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 524 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
525 webrtc::Call::Config::BitrateConfig bitrate_config_; | 525 webrtc::Call::Config::BitrateConfig bitrate_config_; |
526 VideoOptions options_; | |
527 // TODO(deadbeef): Don't duplicate information between | 526 // TODO(deadbeef): Don't duplicate information between |
528 // send_params/recv_params, rtp_extensions, options, etc. | 527 // send_params/recv_params, rtp_extensions, options, etc. |
529 VideoSendParameters send_params_; | 528 VideoSendParameters send_params_; |
530 VideoRecvParameters recv_params_; | 529 VideoRecvParameters recv_params_; |
531 }; | 530 }; |
532 | 531 |
533 } // namespace cricket | 532 } // namespace cricket |
534 | 533 |
535 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 534 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |