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

Unified Diff: webrtc/media/engine/webrtcvideoengine2.h

Issue 2351633002: Let ViEEncoder handle resolution changes. (Closed)
Patch Set: fix line ending. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/media/engine/webrtcvideoengine2.h
diff --git a/webrtc/media/engine/webrtcvideoengine2.h b/webrtc/media/engine/webrtcvideoengine2.h
index b8d17e8105569e44cb2320ee0cd5369b17d4adc3..5bff6e607697c440bd0e058494f9c04f125adcae 100644
--- a/webrtc/media/engine/webrtcvideoengine2.h
+++ b/webrtc/media/engine/webrtcvideoengine2.h
@@ -320,17 +320,13 @@ class WebRtcVideoChannel2 : public VideoMediaChannel, public webrtc::Transport {
bool external;
};
+ // TODO(perkj): VideoFrameInfo is currently used for CPU adaptation since
+ // we currently does not express CPU overuse using SinkWants in lower
mflodman 2016/09/27 11:28:00 s/does/do
perkj_webrtc 2016/09/27 13:45:17 Done.
+ // layers. This will be fixed in an upcoming cl.
struct VideoFrameInfo {
- // Initial encoder configuration (QCIF, 176x144) frame (to ensure that
- // hardware encoders can be initialized). This gives us low memory usage
- // but also makes it so configuration errors are discovered at the time we
- // apply the settings rather than when we get the first frame (waiting for
- // the first frame to know that you gave a bad codec parameter could make
- // debugging hard).
- // TODO(pbos): Consider setting up encoders lazily.
VideoFrameInfo()
- : width(176),
- height(144),
+ : width(0),
+ height(0),
rotation(webrtc::kVideoRotation_0),
is_texture(false) {}
int width;
@@ -345,79 +341,63 @@ class WebRtcVideoChannel2 : public VideoMediaChannel, public webrtc::Transport {
webrtc::VideoCodecVP9 vp9;
};
- static std::vector<webrtc::VideoStream> CreateVideoStreams(
- const VideoCodec& codec,
- const VideoOptions& options,
- int max_bitrate_bps,
- size_t num_streams);
- static std::vector<webrtc::VideoStream> CreateSimulcastVideoStreams(
- const VideoCodec& codec,
- const VideoOptions& options,
- int max_bitrate_bps,
- size_t num_streams);
-
- void* ConfigureVideoEncoderSettings(const VideoCodec& codec)
- EXCLUSIVE_LOCKS_REQUIRED(lock_);
-
- AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec)
- EXCLUSIVE_LOCKS_REQUIRED(lock_);
- void DestroyVideoEncoder(AllocatedEncoder* encoder)
- EXCLUSIVE_LOCKS_REQUIRED(lock_);
- void SetCodec(const VideoCodecSettings& codec)
- EXCLUSIVE_LOCKS_REQUIRED(lock_);
- void RecreateWebRtcStream() EXCLUSIVE_LOCKS_REQUIRED(lock_);
+ void* ConfigureVideoEncoderSettings(const VideoCodec& codec);
+ AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec);
+ void DestroyVideoEncoder(AllocatedEncoder* encoder);
+ void SetCodec(const VideoCodecSettings& codec);
+ void RecreateWebRtcStream();
webrtc::VideoEncoderConfig CreateVideoEncoderConfig(
- const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_);
- void ReconfigureEncoder() EXCLUSIVE_LOCKS_REQUIRED(lock_);
+ const VideoCodec& codec) const;
+ void ReconfigureEncoder();
bool ValidateRtpParameters(const webrtc::RtpParameters& parameters);
// Calls Start or Stop according to whether or not |sending_| is true,
// and whether or not the encoding in |rtp_parameters_| is active.
- void UpdateSendState() EXCLUSIVE_LOCKS_REQUIRED(lock_);
+ void UpdateSendState();
void UpdateHistograms() const EXCLUSIVE_LOCKS_REQUIRED(lock_);
rtc::ThreadChecker thread_checker_;
rtc::AsyncInvoker invoker_;
rtc::Thread* worker_thread_;
- const std::vector<uint32_t> ssrcs_;
- const std::vector<SsrcGroup> ssrc_groups_;
+ const std::vector<uint32_t> ssrcs_ ACCESS_ON(&thread_checker_);
+ const std::vector<SsrcGroup> ssrc_groups_ ACCESS_ON(&thread_checker_);
webrtc::Call* const call_;
- rtc::VideoSinkWants sink_wants_;
+ rtc::VideoSinkWants sink_wants_ ACCESS_ON(&thread_checker_);
// Counter used for deciding if the video resolution is currently
// restricted by CPU usage. It is reset if |source_| is changed.
int cpu_restricted_counter_;
// Total number of times resolution as been requested to be changed due to
// CPU adaptation.
- int number_of_cpu_adapt_changes_;
+ int number_of_cpu_adapt_changes_ ACCESS_ON(&thread_checker_);
// Total number of frames sent to |stream_|.
int frame_count_ GUARDED_BY(lock_);
// Total number of cpu restricted frames sent to |stream_|.
int cpu_restricted_frame_count_ GUARDED_BY(lock_);
- rtc::VideoSourceInterface<cricket::VideoFrame>* source_;
+ rtc::VideoSourceInterface<cricket::VideoFrame>* source_
+ ACCESS_ON(&thread_checker_);
WebRtcVideoEncoderFactory* const external_encoder_factory_
- GUARDED_BY(lock_);
+ ACCESS_ON(&thread_checker_);
rtc::CriticalSection lock_;
- webrtc::VideoSendStream* stream_ GUARDED_BY(lock_);
+ webrtc::VideoSendStream* stream_ ACCESS_ON(&thread_checker_);
rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_
GUARDED_BY(lock_);
// Contains settings that are the same for all streams in the MediaChannel,
// such as codecs, header extensions, and the global bitrate limit for the
// entire channel.
- VideoSendStreamParameters parameters_ GUARDED_BY(lock_);
+ VideoSendStreamParameters parameters_ ACCESS_ON(&thread_checker_);
// Contains settings that are unique for each stream, such as max_bitrate.
// Does *not* contain codecs, however.
// TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_.
// TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only
// one stream per MediaChannel.
- webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_);
- bool pending_encoder_reconfiguration_ GUARDED_BY(lock_);
- VideoEncoderSettings encoder_settings_ GUARDED_BY(lock_);
- AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_);
+ webrtc::RtpParameters rtp_parameters_ ACCESS_ON(&thread_checker_);
+ VideoEncoderSettings encoder_settings_ ACCESS_ON(&thread_checker_);
+ AllocatedEncoder allocated_encoder_ ACCESS_ON(&thread_checker_);
VideoFrameInfo last_frame_info_ GUARDED_BY(lock_);
- bool sending_ GUARDED_BY(lock_);
+ bool sending_ ACCESS_ON(&thread_checker_);
// The timestamp of the last frame received
// Used to generate timestamp for the black frame when source is removed

Powered by Google App Engine
This is Rietveld 408576698