 Chromium Code Reviews
 Chromium Code Reviews Issue 2511703002:
  Wire up FlexFEC in VideoEngine2.  (Closed)
    
  
    Issue 2511703002:
  Wire up FlexFEC in VideoEngine2.  (Closed) 
  | 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 | 
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 private: | 187 private: | 
| 188 class WebRtcVideoReceiveStream; | 188 class WebRtcVideoReceiveStream; | 
| 189 struct VideoCodecSettings { | 189 struct VideoCodecSettings { | 
| 190 VideoCodecSettings(); | 190 VideoCodecSettings(); | 
| 191 | 191 | 
| 192 bool operator==(const VideoCodecSettings& other) const; | 192 bool operator==(const VideoCodecSettings& other) const; | 
| 193 bool operator!=(const VideoCodecSettings& other) const; | 193 bool operator!=(const VideoCodecSettings& other) const; | 
| 194 | 194 | 
| 195 VideoCodec codec; | 195 VideoCodec codec; | 
| 196 webrtc::UlpfecConfig ulpfec; | 196 webrtc::UlpfecConfig ulpfec; | 
| 197 webrtc::FlexfecConfig flexfec; | |
| 197 int rtx_payload_type; | 198 int rtx_payload_type; | 
| 198 }; | 199 }; | 
| 199 | 200 | 
| 200 struct ChangedSendParameters { | 201 struct ChangedSendParameters { | 
| 201 // These optionals are unset if not changed. | 202 // These optionals are unset if not changed. | 
| 202 rtc::Optional<VideoCodecSettings> codec; | 203 rtc::Optional<VideoCodecSettings> codec; | 
| 203 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; | 204 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; | 
| 204 rtc::Optional<int> max_bandwidth_bps; | 205 rtc::Optional<int> max_bandwidth_bps; | 
| 205 rtc::Optional<bool> conference_mode; | 206 rtc::Optional<bool> conference_mode; | 
| 206 rtc::Optional<webrtc::RtcpMode> rtcp_mode; | 207 rtc::Optional<webrtc::RtcpMode> rtcp_mode; | 
| 207 }; | 208 }; | 
| 208 | 209 | 
| 209 struct ChangedRecvParameters { | 210 struct ChangedRecvParameters { | 
| 210 // These optionals are unset if not changed. | 211 // These optionals are unset if not changed. | 
| 211 rtc::Optional<std::vector<VideoCodecSettings>> codec_settings; | 212 rtc::Optional<std::vector<VideoCodecSettings>> codec_settings; | 
| 212 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; | 213 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; | 
| 213 }; | 214 }; | 
| 214 | 215 | 
| 215 bool GetChangedSendParameters(const VideoSendParameters& params, | 216 bool GetChangedSendParameters(const VideoSendParameters& params, | 
| 216 ChangedSendParameters* changed_params) const; | 217 ChangedSendParameters* changed_params) const; | 
| 217 bool GetChangedRecvParameters(const VideoRecvParameters& params, | 218 bool GetChangedRecvParameters(const VideoRecvParameters& params, | 
| 218 ChangedRecvParameters* changed_params) const; | 219 ChangedRecvParameters* changed_params) const; | 
| 219 | 220 | 
| 220 void SetMaxSendBandwidth(int bps); | 221 void SetMaxSendBandwidth(int bps); | 
| 221 | 222 | 
| 222 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, | 223 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config, | 
| 224 webrtc::FlexfecConfig* flexfec_config, | |
| 223 const StreamParams& sp) const; | 225 const StreamParams& sp) const; | 
| 224 bool ValidateSendSsrcAvailability(const StreamParams& sp) const | 226 bool ValidateSendSsrcAvailability(const StreamParams& sp) const | 
| 225 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 227 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 
| 226 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 228 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const | 
| 227 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 229 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 
| 228 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 230 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream) | 
| 229 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 231 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_); | 
| 230 | 232 | 
| 231 static std::string CodecSettingsVectorToString( | 233 static std::string CodecSettingsVectorToString( | 
| 232 const std::vector<VideoCodecSettings>& codecs); | 234 const std::vector<VideoCodecSettings>& codecs); | 
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 // reconstruct the underlying VideoReceiveStream. | 378 // reconstruct the underlying VideoReceiveStream. | 
| 377 class WebRtcVideoReceiveStream | 379 class WebRtcVideoReceiveStream | 
| 378 : public rtc::VideoSinkInterface<webrtc::VideoFrame> { | 380 : public rtc::VideoSinkInterface<webrtc::VideoFrame> { | 
| 379 public: | 381 public: | 
| 380 WebRtcVideoReceiveStream( | 382 WebRtcVideoReceiveStream( | 
| 381 webrtc::Call* call, | 383 webrtc::Call* call, | 
| 382 const StreamParams& sp, | 384 const StreamParams& sp, | 
| 383 webrtc::VideoReceiveStream::Config config, | 385 webrtc::VideoReceiveStream::Config config, | 
| 384 WebRtcVideoDecoderFactory* external_decoder_factory, | 386 WebRtcVideoDecoderFactory* external_decoder_factory, | 
| 385 bool default_stream, | 387 bool default_stream, | 
| 386 const std::vector<VideoCodecSettings>& recv_codecs); | 388 const std::vector<VideoCodecSettings>& recv_codecs, | 
| 389 const webrtc::FlexfecConfig& flexfec_config); | |
| 387 ~WebRtcVideoReceiveStream(); | 390 ~WebRtcVideoReceiveStream(); | 
| 388 | 391 | 
| 389 const std::vector<uint32_t>& GetSsrcs() const; | 392 const std::vector<uint32_t>& GetSsrcs() const; | 
| 390 rtc::Optional<uint32_t> GetFirstPrimarySsrc() const; | 393 rtc::Optional<uint32_t> GetFirstPrimarySsrc() const; | 
| 391 | 394 | 
| 392 void SetLocalSsrc(uint32_t local_ssrc); | 395 void SetLocalSsrc(uint32_t local_ssrc); | 
| 393 // TODO(deadbeef): Move these feedback parameters into the recv parameters. | 396 // TODO(deadbeef): Move these feedback parameters into the recv parameters. | 
| 394 void SetFeedbackParameters(bool nack_enabled, | 397 void SetFeedbackParameters(bool nack_enabled, | 
| 395 bool remb_enabled, | 398 bool remb_enabled, | 
| 396 bool transport_cc_enabled, | 399 bool transport_cc_enabled, | 
| (...skipping 26 matching lines...) Expand all Loading... | |
| 423 AllocatedDecoder CreateOrReuseVideoDecoder( | 426 AllocatedDecoder CreateOrReuseVideoDecoder( | 
| 424 std::vector<AllocatedDecoder>* old_decoder, | 427 std::vector<AllocatedDecoder>* old_decoder, | 
| 425 const VideoCodec& codec); | 428 const VideoCodec& codec); | 
| 426 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); | 429 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); | 
| 427 | 430 | 
| 428 std::string GetCodecNameFromPayloadType(int payload_type); | 431 std::string GetCodecNameFromPayloadType(int payload_type); | 
| 429 | 432 | 
| 430 webrtc::Call* const call_; | 433 webrtc::Call* const call_; | 
| 431 StreamParams stream_params_; | 434 StreamParams stream_params_; | 
| 432 | 435 | 
| 436 // Both |stream_| and |flexfec_stream_| are owned by |this|. | |
| 
magjed_webrtc
2016/11/21 13:55:13
I'm still slightly confused, because |call_| actua
 
brandtr
2016/11/21 16:03:47
My original thinking was that the caller owns the
 | |
| 433 webrtc::VideoReceiveStream* stream_; | 437 webrtc::VideoReceiveStream* stream_; | 
| 434 const bool default_stream_; | 438 const bool default_stream_; | 
| 435 webrtc::VideoReceiveStream::Config config_; | 439 webrtc::VideoReceiveStream::Config config_; | 
| 440 webrtc::FlexfecConfig flexfec_config_; | |
| 441 webrtc::FlexfecReceiveStream* flexfec_stream_; | |
| 436 | 442 | 
| 437 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 443 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 
| 438 std::vector<AllocatedDecoder> allocated_decoders_; | 444 std::vector<AllocatedDecoder> allocated_decoders_; | 
| 439 | 445 | 
| 440 rtc::CriticalSection sink_lock_; | 446 rtc::CriticalSection sink_lock_; | 
| 441 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink_ GUARDED_BY(sink_lock_); | 447 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink_ GUARDED_BY(sink_lock_); | 
| 442 // Expands remote RTP timestamps to int64_t to be able to estimate how long | 448 // Expands remote RTP timestamps to int64_t to be able to estimate how long | 
| 443 // the stream has been running. | 449 // the stream has been running. | 
| 444 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ | 450 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ | 
| 445 GUARDED_BY(sink_lock_); | 451 GUARDED_BY(sink_lock_); | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 // send_params/recv_params, rtp_extensions, options, etc. | 511 // send_params/recv_params, rtp_extensions, options, etc. | 
| 506 VideoSendParameters send_params_; | 512 VideoSendParameters send_params_; | 
| 507 VideoOptions default_send_options_; | 513 VideoOptions default_send_options_; | 
| 508 VideoRecvParameters recv_params_; | 514 VideoRecvParameters recv_params_; | 
| 509 int64_t last_stats_log_ms_; | 515 int64_t last_stats_log_ms_; | 
| 510 }; | 516 }; | 
| 511 | 517 | 
| 512 } // namespace cricket | 518 } // namespace cricket | 
| 513 | 519 | 
| 514 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 520 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ | 
| OLD | NEW |