Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.h

Issue 2911913002: Recreate FlexfecReceiveStream separately from VideoReceiveStream. (Closed)
Patch Set: perkj comments 1. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvideoengine2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 ADAPTREASON_NONE = 0, 184 ADAPTREASON_NONE = 0,
185 ADAPTREASON_CPU = 1, 185 ADAPTREASON_CPU = 1,
186 ADAPTREASON_BANDWIDTH = 2, 186 ADAPTREASON_BANDWIDTH = 2,
187 }; 187 };
188 188
189 private: 189 private:
190 class WebRtcVideoReceiveStream; 190 class WebRtcVideoReceiveStream;
191 struct VideoCodecSettings { 191 struct VideoCodecSettings {
192 VideoCodecSettings(); 192 VideoCodecSettings();
193 193
194 // Checks if all members of |*this| are equal to the corresponding members
195 // of |other|.
194 bool operator==(const VideoCodecSettings& other) const; 196 bool operator==(const VideoCodecSettings& other) const;
195 bool operator!=(const VideoCodecSettings& other) const; 197 bool operator!=(const VideoCodecSettings& other) const;
196 198
199 // Checks if all members of |a|, except |flexfec_payload_type|, are equal
200 // to the corresponding members of |b|.
201 static bool EqualsDisregardingFlexfec(const VideoCodecSettings& a,
202 const VideoCodecSettings& b);
203
197 VideoCodec codec; 204 VideoCodec codec;
198 webrtc::UlpfecConfig ulpfec; 205 webrtc::UlpfecConfig ulpfec;
199 int flexfec_payload_type; 206 int flexfec_payload_type;
200 int rtx_payload_type; 207 int rtx_payload_type;
201 }; 208 };
202 209
203 struct ChangedSendParameters { 210 struct ChangedSendParameters {
204 // These optionals are unset if not changed. 211 // These optionals are unset if not changed.
205 rtc::Optional<VideoCodecSettings> codec; 212 rtc::Optional<VideoCodecSettings> codec;
206 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; 213 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
207 rtc::Optional<int> max_bandwidth_bps; 214 rtc::Optional<int> max_bandwidth_bps;
208 rtc::Optional<bool> conference_mode; 215 rtc::Optional<bool> conference_mode;
209 rtc::Optional<webrtc::RtcpMode> rtcp_mode; 216 rtc::Optional<webrtc::RtcpMode> rtcp_mode;
210 }; 217 };
211 218
212 struct ChangedRecvParameters { 219 struct ChangedRecvParameters {
213 // These optionals are unset if not changed. 220 // These optionals are unset if not changed.
214 rtc::Optional<std::vector<VideoCodecSettings>> codec_settings; 221 rtc::Optional<std::vector<VideoCodecSettings>> codec_settings;
215 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions; 222 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
223 // Keep track of the FlexFEC payload type separately from |codec_settings|.
224 // This allows us to recreate the FlexfecReceiveStream separately from the
225 // VideoReceiveStream when the FlexFEC payload type is changed.
226 rtc::Optional<int> flexfec_payload_type;
216 }; 227 };
217 228
218 bool GetChangedSendParameters(const VideoSendParameters& params, 229 bool GetChangedSendParameters(const VideoSendParameters& params,
219 ChangedSendParameters* changed_params) const; 230 ChangedSendParameters* changed_params) const;
220 bool GetChangedRecvParameters(const VideoRecvParameters& params, 231 bool GetChangedRecvParameters(const VideoRecvParameters& params,
221 ChangedRecvParameters* changed_params) const; 232 ChangedRecvParameters* changed_params) const;
222 233
223 void SetMaxSendBandwidth(int bps); 234 void SetMaxSendBandwidth(int bps);
224 235
225 void ConfigureReceiverRtp( 236 void ConfigureReceiverRtp(
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 AllocatedDecoder(webrtc::VideoDecoder* decoder, 411 AllocatedDecoder(webrtc::VideoDecoder* decoder,
401 webrtc::VideoCodecType type, 412 webrtc::VideoCodecType type,
402 bool external); 413 bool external);
403 webrtc::VideoDecoder* decoder; 414 webrtc::VideoDecoder* decoder;
404 // Decoder wrapped into a fallback decoder to permit software fallback. 415 // Decoder wrapped into a fallback decoder to permit software fallback.
405 webrtc::VideoDecoder* external_decoder; 416 webrtc::VideoDecoder* external_decoder;
406 webrtc::VideoCodecType type; 417 webrtc::VideoCodecType type;
407 bool external; 418 bool external;
408 }; 419 };
409 420
410 void RecreateWebRtcStream(); 421 void RecreateWebRtcVideoStream();
422 void MaybeRecreateWebRtcFlexfecStream();
411 423
412 void ConfigureCodecs(const std::vector<VideoCodecSettings>& recv_codecs, 424 void ConfigureCodecs(const std::vector<VideoCodecSettings>& recv_codecs,
413 std::vector<AllocatedDecoder>* old_codecs); 425 std::vector<AllocatedDecoder>* old_codecs);
426 void ConfigureFlexfecCodec(int flexfec_payload_type);
414 AllocatedDecoder CreateOrReuseVideoDecoder( 427 AllocatedDecoder CreateOrReuseVideoDecoder(
415 std::vector<AllocatedDecoder>* old_decoder, 428 std::vector<AllocatedDecoder>* old_decoder,
416 const VideoCodec& codec); 429 const VideoCodec& codec);
417 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders); 430 void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders);
418 431
419 std::string GetCodecNameFromPayloadType(int payload_type); 432 std::string GetCodecNameFromPayloadType(int payload_type);
420 433
421 webrtc::Call* const call_; 434 webrtc::Call* const call_;
422 StreamParams stream_params_; 435 StreamParams stream_params_;
423 436
(...skipping 29 matching lines...) Expand all
453 bool SendRtcp(const uint8_t* data, size_t len) override; 466 bool SendRtcp(const uint8_t* data, size_t len) override;
454 467
455 static std::vector<VideoCodecSettings> MapCodecs( 468 static std::vector<VideoCodecSettings> MapCodecs(
456 const std::vector<VideoCodec>& codecs); 469 const std::vector<VideoCodec>& codecs);
457 // Select what video codec will be used for sending, i.e. what codec is used 470 // Select what video codec will be used for sending, i.e. what codec is used
458 // for local encoding, based on supported remote codecs. The first remote 471 // for local encoding, based on supported remote codecs. The first remote
459 // codec that is supported locally will be selected. 472 // codec that is supported locally will be selected.
460 rtc::Optional<VideoCodecSettings> SelectSendVideoCodec( 473 rtc::Optional<VideoCodecSettings> SelectSendVideoCodec(
461 const std::vector<VideoCodecSettings>& remote_mapped_codecs) const; 474 const std::vector<VideoCodecSettings>& remote_mapped_codecs) const;
462 475
463 static bool ReceiveCodecsHaveChanged(std::vector<VideoCodecSettings> before, 476 static bool NonFlexfecReceiveCodecsHaveChanged(
464 std::vector<VideoCodecSettings> after); 477 std::vector<VideoCodecSettings> before,
478 std::vector<VideoCodecSettings> after);
465 479
466 void FillSenderStats(VideoMediaInfo* info, bool log_stats); 480 void FillSenderStats(VideoMediaInfo* info, bool log_stats);
467 void FillReceiverStats(VideoMediaInfo* info, bool log_stats); 481 void FillReceiverStats(VideoMediaInfo* info, bool log_stats);
468 void FillBandwidthEstimationStats(const webrtc::Call::Stats& stats, 482 void FillBandwidthEstimationStats(const webrtc::Call::Stats& stats,
469 VideoMediaInfo* info); 483 VideoMediaInfo* info);
470 void FillSendAndReceiveCodecStats(VideoMediaInfo* video_media_info); 484 void FillSendAndReceiveCodecStats(VideoMediaInfo* video_media_info);
471 485
472 rtc::ThreadChecker thread_checker_; 486 rtc::ThreadChecker thread_checker_;
473 487
474 uint32_t rtcp_receiver_report_ssrc_; 488 uint32_t rtcp_receiver_report_ssrc_;
(...skipping 14 matching lines...) Expand all
489 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_); 503 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_);
490 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_); 504 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_);
491 505
492 rtc::Optional<VideoCodecSettings> send_codec_; 506 rtc::Optional<VideoCodecSettings> send_codec_;
493 rtc::Optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_; 507 rtc::Optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_;
494 508
495 WebRtcVideoEncoderFactory* const external_encoder_factory_; 509 WebRtcVideoEncoderFactory* const external_encoder_factory_;
496 WebRtcVideoDecoderFactory* const external_decoder_factory_; 510 WebRtcVideoDecoderFactory* const external_decoder_factory_;
497 std::vector<VideoCodecSettings> recv_codecs_; 511 std::vector<VideoCodecSettings> recv_codecs_;
498 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 512 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
513 // See reason for keeping track of the FlexFEC payload type separately in
514 // comment in WebRtcVideoChannel2::ChangedRecvParameters.
515 int recv_flexfec_payload_type_;
499 webrtc::Call::Config::BitrateConfig bitrate_config_; 516 webrtc::Call::Config::BitrateConfig bitrate_config_;
500 // TODO(deadbeef): Don't duplicate information between 517 // TODO(deadbeef): Don't duplicate information between
501 // send_params/recv_params, rtp_extensions, options, etc. 518 // send_params/recv_params, rtp_extensions, options, etc.
502 VideoSendParameters send_params_; 519 VideoSendParameters send_params_;
503 VideoOptions default_send_options_; 520 VideoOptions default_send_options_;
504 VideoRecvParameters recv_params_; 521 VideoRecvParameters recv_params_;
505 int64_t last_stats_log_ms_; 522 int64_t last_stats_log_ms_;
506 }; 523 };
507 524
508 } // namespace cricket 525 } // namespace cricket
509 526
510 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ 527 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvideoengine2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698