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

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

Issue 2067103002: Avoid unnecessary HW video encoder reconfiguration (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Code review feedback Created 4 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
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 public: 247 public:
248 WebRtcVideoSendStream( 248 WebRtcVideoSendStream(
249 webrtc::Call* call, 249 webrtc::Call* call,
250 const StreamParams& sp, 250 const StreamParams& sp,
251 const webrtc::VideoSendStream::Config& config, 251 const webrtc::VideoSendStream::Config& config,
252 const VideoOptions& options, 252 const VideoOptions& options,
253 WebRtcVideoEncoderFactory* external_encoder_factory, 253 WebRtcVideoEncoderFactory* external_encoder_factory,
254 bool enable_cpu_overuse_detection, 254 bool enable_cpu_overuse_detection,
255 int max_bitrate_bps, 255 int max_bitrate_bps,
256 const rtc::Optional<VideoCodecSettings>& codec_settings, 256 const rtc::Optional<VideoCodecSettings>& codec_settings,
257 const std::vector<webrtc::RtpExtension>& rtp_extensions, 257 const rtc::Optional<std::vector<webrtc::RtpExtension>>& rtp_extensions,
258 const VideoSendParameters& send_params); 258 const VideoSendParameters& send_params);
259 virtual ~WebRtcVideoSendStream(); 259 virtual ~WebRtcVideoSendStream();
260 260
261 void SetSendParameters(const ChangedSendParameters& send_params); 261 void SetSendParameters(const ChangedSendParameters& send_params);
262 bool SetRtpParameters(const webrtc::RtpParameters& parameters); 262 bool SetRtpParameters(const webrtc::RtpParameters& parameters);
263 webrtc::RtpParameters GetRtpParameters() const; 263 webrtc::RtpParameters GetRtpParameters() const;
264 264
265 void OnFrame(const cricket::VideoFrame& frame) override; 265 void OnFrame(const cricket::VideoFrame& frame) override;
266 bool SetVideoSend(bool mute, 266 bool SetVideoSend(bool mute,
267 const VideoOptions* options, 267 const VideoOptions* options,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec) 345 AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec)
346 EXCLUSIVE_LOCKS_REQUIRED(lock_); 346 EXCLUSIVE_LOCKS_REQUIRED(lock_);
347 void DestroyVideoEncoder(AllocatedEncoder* encoder) 347 void DestroyVideoEncoder(AllocatedEncoder* encoder)
348 EXCLUSIVE_LOCKS_REQUIRED(lock_); 348 EXCLUSIVE_LOCKS_REQUIRED(lock_);
349 void SetCodec(const VideoCodecSettings& codec) 349 void SetCodec(const VideoCodecSettings& codec)
350 EXCLUSIVE_LOCKS_REQUIRED(lock_); 350 EXCLUSIVE_LOCKS_REQUIRED(lock_);
351 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); 351 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_);
352 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( 352 webrtc::VideoEncoderConfig CreateVideoEncoderConfig(
353 const Dimensions& dimensions, 353 const Dimensions& dimensions,
354 bool encode_from_texture,
354 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); 355 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_);
355 void SetDimensions(int width, int height) 356 void ReconfigureEncoderIfNecessary() EXCLUSIVE_LOCKS_REQUIRED(lock_);
356 EXCLUSIVE_LOCKS_REQUIRED(lock_);
357 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters); 357 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters);
358 358
359 // Calls Start or Stop according to whether or not |sending_| is true, 359 // Calls Start or Stop according to whether or not |sending_| is true,
360 // and whether or not the encoding in |rtp_parameters_| is active. 360 // and whether or not the encoding in |rtp_parameters_| is active.
361 void UpdateSendState() EXCLUSIVE_LOCKS_REQUIRED(lock_); 361 void UpdateSendState() EXCLUSIVE_LOCKS_REQUIRED(lock_);
362 362
363 rtc::ThreadChecker thread_checker_; 363 rtc::ThreadChecker thread_checker_;
364 rtc::AsyncInvoker invoker_; 364 rtc::AsyncInvoker invoker_;
365 rtc::Thread* worker_thread_; 365 rtc::Thread* worker_thread_;
366 const std::vector<uint32_t> ssrcs_; 366 const std::vector<uint32_t> ssrcs_;
(...skipping 21 matching lines...) Expand all
388 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. 388 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_.
389 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only 389 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only
390 // one stream per MediaChannel. 390 // one stream per MediaChannel.
391 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); 391 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_);
392 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); 392 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_);
393 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); 393 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_);
394 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); 394 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_);
395 Dimensions last_dimensions_ GUARDED_BY(lock_); 395 Dimensions last_dimensions_ GUARDED_BY(lock_);
396 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) = 396 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) =
397 webrtc::kVideoRotation_0; 397 webrtc::kVideoRotation_0;
398 bool last_frame_is_texture_ GUARDED_BY(lock_) = false;
pthatcher1 2016/06/15 20:40:23 We've got last_dimensions_, last_rotation_, and la
skvlad 2016/06/15 22:10:36 Replaced with VideoFrameInfo. Great suggestion, th
398 399
399 bool sending_ GUARDED_BY(lock_); 400 bool sending_ GUARDED_BY(lock_);
400 401
401 // The timestamp of the first frame received 402 // The timestamp of the first frame received
402 // Used to generate the timestamps of subsequent frames 403 // Used to generate the timestamps of subsequent frames
403 rtc::Optional<int64_t> first_frame_timestamp_ms_ GUARDED_BY(lock_); 404 rtc::Optional<int64_t> first_frame_timestamp_ms_ GUARDED_BY(lock_);
404 405
405 // The timestamp of the last frame received 406 // The timestamp of the last frame received
406 // Used to generate timestamp for the black frame when source is removed 407 // Used to generate timestamp for the black frame when source is removed
407 int64_t last_frame_timestamp_ms_ GUARDED_BY(lock_); 408 int64_t last_frame_timestamp_ms_ GUARDED_BY(lock_);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 rtc::CriticalSection stream_crit_; 532 rtc::CriticalSection stream_crit_;
532 // Using primary-ssrc (first ssrc) as key. 533 // Using primary-ssrc (first ssrc) as key.
533 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ 534 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_
534 GUARDED_BY(stream_crit_); 535 GUARDED_BY(stream_crit_);
535 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_ 536 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_
536 GUARDED_BY(stream_crit_); 537 GUARDED_BY(stream_crit_);
537 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_); 538 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_);
538 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_); 539 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_);
539 540
540 rtc::Optional<VideoCodecSettings> send_codec_; 541 rtc::Optional<VideoCodecSettings> send_codec_;
541 std::vector<webrtc::RtpExtension> send_rtp_extensions_; 542 rtc::Optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_;
542 543
543 WebRtcVideoEncoderFactory* const external_encoder_factory_; 544 WebRtcVideoEncoderFactory* const external_encoder_factory_;
544 WebRtcVideoDecoderFactory* const external_decoder_factory_; 545 WebRtcVideoDecoderFactory* const external_decoder_factory_;
545 std::vector<VideoCodecSettings> recv_codecs_; 546 std::vector<VideoCodecSettings> recv_codecs_;
546 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 547 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
547 webrtc::Call::Config::BitrateConfig bitrate_config_; 548 webrtc::Call::Config::BitrateConfig bitrate_config_;
548 // TODO(deadbeef): Don't duplicate information between 549 // TODO(deadbeef): Don't duplicate information between
549 // send_params/recv_params, rtp_extensions, options, etc. 550 // send_params/recv_params, rtp_extensions, options, etc.
550 VideoSendParameters send_params_; 551 VideoSendParameters send_params_;
551 VideoOptions default_send_options_; 552 VideoOptions default_send_options_;
552 VideoRecvParameters recv_params_; 553 VideoRecvParameters recv_params_;
553 bool red_disabled_by_remote_side_; 554 bool red_disabled_by_remote_side_;
554 }; 555 };
555 556
556 } // namespace cricket 557 } // namespace cricket
557 558
558 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ 559 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698