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

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: Optimistically guess rotation is supported 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 union VideoEncoderSettings { 325 union VideoEncoderSettings {
326 webrtc::VideoCodecH264 h264; 326 webrtc::VideoCodecH264 h264;
327 webrtc::VideoCodecVP8 vp8; 327 webrtc::VideoCodecVP8 vp8;
328 webrtc::VideoCodecVP9 vp9; 328 webrtc::VideoCodecVP9 vp9;
329 }; 329 };
330 330
331 static std::vector<webrtc::VideoStream> CreateVideoStreams( 331 static std::vector<webrtc::VideoStream> CreateVideoStreams(
332 const VideoCodec& codec, 332 const VideoCodec& codec,
333 const VideoOptions& options, 333 const VideoOptions& options,
334 int max_bitrate_bps, 334 int max_bitrate_bps,
335 size_t num_streams); 335 size_t num_streams,
336 bool encode_from_texture);
336 static std::vector<webrtc::VideoStream> CreateSimulcastVideoStreams( 337 static std::vector<webrtc::VideoStream> CreateSimulcastVideoStreams(
337 const VideoCodec& codec, 338 const VideoCodec& codec,
338 const VideoOptions& options, 339 const VideoOptions& options,
339 int max_bitrate_bps, 340 int max_bitrate_bps,
340 size_t num_streams); 341 size_t num_streams);
341 342
342 void* ConfigureVideoEncoderSettings(const VideoCodec& codec) 343 void* ConfigureVideoEncoderSettings(const VideoCodec& codec)
343 EXCLUSIVE_LOCKS_REQUIRED(lock_); 344 EXCLUSIVE_LOCKS_REQUIRED(lock_);
344 345
345 AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec) 346 AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec)
346 EXCLUSIVE_LOCKS_REQUIRED(lock_); 347 EXCLUSIVE_LOCKS_REQUIRED(lock_);
347 void DestroyVideoEncoder(AllocatedEncoder* encoder) 348 void DestroyVideoEncoder(AllocatedEncoder* encoder)
348 EXCLUSIVE_LOCKS_REQUIRED(lock_); 349 EXCLUSIVE_LOCKS_REQUIRED(lock_);
349 void SetCodec(const VideoCodecSettings& codec) 350 void SetCodec(const VideoCodecSettings& codec)
350 EXCLUSIVE_LOCKS_REQUIRED(lock_); 351 EXCLUSIVE_LOCKS_REQUIRED(lock_);
351 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_); 352 void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_);
352 webrtc::VideoEncoderConfig CreateVideoEncoderConfig( 353 webrtc::VideoEncoderConfig CreateVideoEncoderConfig(
353 const Dimensions& dimensions, 354 const Dimensions& dimensions,
355 bool encode_from_texture,
354 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_); 356 const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_);
355 void SetDimensions(int width, int height) 357 void ReconfigureEncoderIfNecessary() EXCLUSIVE_LOCKS_REQUIRED(lock_);
356 EXCLUSIVE_LOCKS_REQUIRED(lock_);
357 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters); 358 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters);
358 359
359 // Calls Start or Stop according to whether or not |sending_| is true, 360 // Calls Start or Stop according to whether or not |sending_| is true,
360 // and whether or not the encoding in |rtp_parameters_| is active. 361 // and whether or not the encoding in |rtp_parameters_| is active.
361 void UpdateSendState() EXCLUSIVE_LOCKS_REQUIRED(lock_); 362 void UpdateSendState() EXCLUSIVE_LOCKS_REQUIRED(lock_);
362 363
363 rtc::ThreadChecker thread_checker_; 364 rtc::ThreadChecker thread_checker_;
364 rtc::AsyncInvoker invoker_; 365 rtc::AsyncInvoker invoker_;
365 rtc::Thread* worker_thread_; 366 rtc::Thread* worker_thread_;
366 const std::vector<uint32_t> ssrcs_; 367 const std::vector<uint32_t> ssrcs_;
(...skipping 21 matching lines...) Expand all
388 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_. 389 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_.
389 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only 390 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only
390 // one stream per MediaChannel. 391 // one stream per MediaChannel.
391 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_); 392 webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_);
392 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_); 393 bool pending_encoder_reconfiguration_ GUARDED_BY(lock_);
393 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_); 394 VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_);
394 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); 395 AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_);
395 Dimensions last_dimensions_ GUARDED_BY(lock_); 396 Dimensions last_dimensions_ GUARDED_BY(lock_);
396 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) = 397 webrtc::VideoRotation last_rotation_ GUARDED_BY(lock_) =
397 webrtc::kVideoRotation_0; 398 webrtc::kVideoRotation_0;
399 bool last_frame_in_texture_ GUARDED_BY(lock_) = false;
perkj_webrtc 2016/06/15 11:31:29 last_frame_is_texture_ ?
skvlad 2016/06/15 19:44:34 Done.
398 400
399 bool sending_ GUARDED_BY(lock_); 401 bool sending_ GUARDED_BY(lock_);
400 402
401 // The timestamp of the first frame received 403 // The timestamp of the first frame received
402 // Used to generate the timestamps of subsequent frames 404 // Used to generate the timestamps of subsequent frames
403 rtc::Optional<int64_t> first_frame_timestamp_ms_ GUARDED_BY(lock_); 405 rtc::Optional<int64_t> first_frame_timestamp_ms_ GUARDED_BY(lock_);
404 406
405 // The timestamp of the last frame received 407 // The timestamp of the last frame received
406 // Used to generate timestamp for the black frame when source is removed 408 // Used to generate timestamp for the black frame when source is removed
407 int64_t last_frame_timestamp_ms_ GUARDED_BY(lock_); 409 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_; 533 rtc::CriticalSection stream_crit_;
532 // Using primary-ssrc (first ssrc) as key. 534 // Using primary-ssrc (first ssrc) as key.
533 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ 535 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_
534 GUARDED_BY(stream_crit_); 536 GUARDED_BY(stream_crit_);
535 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_ 537 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_
536 GUARDED_BY(stream_crit_); 538 GUARDED_BY(stream_crit_);
537 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_); 539 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_);
538 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_); 540 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_);
539 541
540 rtc::Optional<VideoCodecSettings> send_codec_; 542 rtc::Optional<VideoCodecSettings> send_codec_;
541 std::vector<webrtc::RtpExtension> send_rtp_extensions_; 543 rtc::Optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_;
542 544
543 WebRtcVideoEncoderFactory* const external_encoder_factory_; 545 WebRtcVideoEncoderFactory* const external_encoder_factory_;
544 WebRtcVideoDecoderFactory* const external_decoder_factory_; 546 WebRtcVideoDecoderFactory* const external_decoder_factory_;
545 std::vector<VideoCodecSettings> recv_codecs_; 547 std::vector<VideoCodecSettings> recv_codecs_;
546 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 548 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
547 webrtc::Call::Config::BitrateConfig bitrate_config_; 549 webrtc::Call::Config::BitrateConfig bitrate_config_;
548 // TODO(deadbeef): Don't duplicate information between 550 // TODO(deadbeef): Don't duplicate information between
549 // send_params/recv_params, rtp_extensions, options, etc. 551 // send_params/recv_params, rtp_extensions, options, etc.
550 VideoSendParameters send_params_; 552 VideoSendParameters send_params_;
551 VideoOptions default_send_options_; 553 VideoOptions default_send_options_;
552 VideoRecvParameters recv_params_; 554 VideoRecvParameters recv_params_;
553 bool red_disabled_by_remote_side_; 555 bool red_disabled_by_remote_side_;
554 }; 556 };
555 557
556 } // namespace cricket 558 } // namespace cricket
557 559
558 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_ 560 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698