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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 }; | 223 }; |
224 | 224 |
225 bool GetChangedSendParameters(const VideoSendParameters& params, | 225 bool GetChangedSendParameters(const VideoSendParameters& params, |
226 ChangedSendParameters* changed_params) const; | 226 ChangedSendParameters* changed_params) const; |
227 bool GetChangedRecvParameters(const VideoRecvParameters& params, | 227 bool GetChangedRecvParameters(const VideoRecvParameters& params, |
228 ChangedRecvParameters* changed_params) const; | 228 ChangedRecvParameters* changed_params) const; |
229 | 229 |
230 bool MuteStream(uint32_t ssrc, bool mute); | 230 bool MuteStream(uint32_t ssrc, bool mute); |
231 | 231 |
232 void SetMaxSendBandwidth(int bps); | 232 void SetMaxSendBandwidth(int bps); |
233 void SetOptions(const VideoOptions& options); | 233 void SetSharedOptions(const VideoOptions& options); |
| 234 bool SetOptions(uint32_t ssrc, const VideoOptions& options); |
234 | 235 |
235 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, | 236 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, |
236 const StreamParams& sp) const; | 237 const StreamParams& sp) const; |
237 bool CodecIsExternallySupported(const std::string& name) const; | 238 bool CodecIsExternallySupported(const std::string& name) const; |
238 bool ValidateSendSsrcAvailability(const StreamParams& sp) const | 239 bool ValidateSendSsrcAvailability(const StreamParams& sp) const |
239 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 240 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
240 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 241 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const |
241 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 242 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
242 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 243 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) |
243 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 244 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); |
244 | 245 |
245 static std::string CodecSettingsVectorToString( | 246 static std::string CodecSettingsVectorToString( |
246 const std::vector<VideoCodecSettings>& codecs); | 247 const std::vector<VideoCodecSettings>& codecs); |
247 | 248 |
248 // Wrapper for the sender part, this is where the capturer is connected and | 249 // Wrapper for the sender part, this is where the capturer is connected and |
249 // frames are then converted from cricket frames to webrtc frames. | 250 // frames are then converted from cricket frames to webrtc frames. |
250 class WebRtcVideoSendStream : public sigslot::has_slots<> { | 251 class WebRtcVideoSendStream : public sigslot::has_slots<> { |
251 public: | 252 public: |
252 WebRtcVideoSendStream( | 253 WebRtcVideoSendStream( |
253 webrtc::Call* call, | 254 webrtc::Call* call, |
254 const StreamParams& sp, | 255 const StreamParams& sp, |
255 const webrtc::VideoSendStream::Config& config, | 256 const webrtc::VideoSendStream::Config& config, |
256 WebRtcVideoEncoderFactory* external_encoder_factory, | 257 WebRtcVideoEncoderFactory* external_encoder_factory, |
257 const VideoOptions& options, | |
258 int max_bitrate_bps, | 258 int max_bitrate_bps, |
259 const rtc::Optional<VideoCodecSettings>& codec_settings, | 259 const rtc::Optional<VideoCodecSettings>& codec_settings, |
260 const std::vector<webrtc::RtpExtension>& rtp_extensions, | 260 const std::vector<webrtc::RtpExtension>& rtp_extensions, |
261 const VideoSendParameters& send_params); | 261 const VideoSendParameters& send_params); |
262 ~WebRtcVideoSendStream(); | 262 ~WebRtcVideoSendStream(); |
263 | 263 |
264 void SetOptions(const VideoOptions& options); | 264 void SetOptions(const VideoOptions& options); |
265 // TODO(pbos): Move logic from SetOptions into this method. | 265 // TODO(pbos): Move logic from SetOptions into this method. |
266 void SetSendParameters(const ChangedSendParameters& send_params); | 266 void SetSendParameters(const ChangedSendParameters& send_params); |
267 | 267 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 // the stream has been running. | 465 // the stream has been running. |
466 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ | 466 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ |
467 GUARDED_BY(sink_lock_); | 467 GUARDED_BY(sink_lock_); |
468 int64_t first_frame_timestamp_ GUARDED_BY(sink_lock_); | 468 int64_t first_frame_timestamp_ GUARDED_BY(sink_lock_); |
469 // Start NTP time is estimated as current remote NTP time (estimated from | 469 // Start NTP time is estimated as current remote NTP time (estimated from |
470 // RTCP) minus the elapsed time, as soon as remote NTP time is available. | 470 // RTCP) minus the elapsed time, as soon as remote NTP time is available. |
471 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_); | 471 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_); |
472 }; | 472 }; |
473 | 473 |
474 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); | 474 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); |
475 void SetDefaultOptions(); | |
476 | 475 |
477 bool SendRtp(const uint8_t* data, | 476 bool SendRtp(const uint8_t* data, |
478 size_t len, | 477 size_t len, |
479 const webrtc::PacketOptions& options) override; | 478 const webrtc::PacketOptions& options) override; |
480 bool SendRtcp(const uint8_t* data, size_t len) override; | 479 bool SendRtcp(const uint8_t* data, size_t len) override; |
481 | 480 |
482 void StartAllSendStreams(); | 481 void StartAllSendStreams(); |
483 void StopAllSendStreams(); | 482 void StopAllSendStreams(); |
484 | 483 |
485 static std::vector<VideoCodecSettings> MapCodecs( | 484 static std::vector<VideoCodecSettings> MapCodecs( |
(...skipping 18 matching lines...) Expand all Loading... |
504 | 503 |
505 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; | 504 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_; |
506 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; | 505 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_; |
507 | 506 |
508 // Separate list of set capturers used to signal CPU adaptation. These should | 507 // Separate list of set capturers used to signal CPU adaptation. These should |
509 // not be locked while calling methods that take other locks to prevent | 508 // not be locked while calling methods that take other locks to prevent |
510 // lock-order inversions. | 509 // lock-order inversions. |
511 rtc::CriticalSection capturer_crit_; | 510 rtc::CriticalSection capturer_crit_; |
512 bool signal_cpu_adaptation_ GUARDED_BY(capturer_crit_); | 511 bool signal_cpu_adaptation_ GUARDED_BY(capturer_crit_); |
513 std::map<uint32_t, VideoCapturer*> capturers_ GUARDED_BY(capturer_crit_); | 512 std::map<uint32_t, VideoCapturer*> capturers_ GUARDED_BY(capturer_crit_); |
| 513 bool disable_prerenderer_smoothing_; |
514 | 514 |
515 rtc::CriticalSection stream_crit_; | 515 rtc::CriticalSection stream_crit_; |
516 // Using primary-ssrc (first ssrc) as key. | 516 // Using primary-ssrc (first ssrc) as key. |
517 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ | 517 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ |
518 GUARDED_BY(stream_crit_); | 518 GUARDED_BY(stream_crit_); |
519 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_ | 519 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_ |
520 GUARDED_BY(stream_crit_); | 520 GUARDED_BY(stream_crit_); |
521 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_); | 521 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_); |
522 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_); | 522 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_); |
523 | 523 |
524 rtc::Optional<VideoCodecSettings> send_codec_; | 524 rtc::Optional<VideoCodecSettings> send_codec_; |
525 std::vector<webrtc::RtpExtension> send_rtp_extensions_; | 525 std::vector<webrtc::RtpExtension> send_rtp_extensions_; |
526 | 526 |
527 WebRtcVideoEncoderFactory* const external_encoder_factory_; | 527 WebRtcVideoEncoderFactory* const external_encoder_factory_; |
528 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 528 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
529 std::vector<VideoCodecSettings> recv_codecs_; | 529 std::vector<VideoCodecSettings> recv_codecs_; |
530 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 530 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
531 webrtc::Call::Config::BitrateConfig bitrate_config_; | 531 webrtc::Call::Config::BitrateConfig bitrate_config_; |
532 VideoOptions options_; | |
533 // TODO(deadbeef): Don't duplicate information between | 532 // TODO(deadbeef): Don't duplicate information between |
534 // send_params/recv_params, rtp_extensions, options, etc. | 533 // send_params/recv_params, rtp_extensions, options, etc. |
535 VideoSendParameters send_params_; | 534 VideoSendParameters send_params_; |
536 VideoRecvParameters recv_params_; | 535 VideoRecvParameters recv_params_; |
537 }; | 536 }; |
538 | 537 |
539 } // namespace cricket | 538 } // namespace cricket |
540 | 539 |
541 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 540 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |