Index: webrtc/media/engine/webrtcvideoengine2.h |
diff --git a/webrtc/media/engine/webrtcvideoengine2.h b/webrtc/media/engine/webrtcvideoengine2.h |
index cc4b33e879018b6c7771de309b6e1fa3dfca909e..bea1b1785ac1cba6c9294d84796e71b1a28c17fa 100644 |
--- a/webrtc/media/engine/webrtcvideoengine2.h |
+++ b/webrtc/media/engine/webrtcvideoengine2.h |
@@ -319,17 +319,13 @@ class WebRtcVideoChannel2 : public VideoMediaChannel, public webrtc::Transport { |
bool external; |
}; |
+ // TODO(perkj): VideoFrameInfo is currently used for CPU adaptation since |
+ // we currently do not express CPU overuse using SinkWants in lower |
+ // 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; |
@@ -338,79 +334,63 @@ class WebRtcVideoChannel2 : public VideoMediaChannel, public webrtc::Transport { |
bool is_texture; |
}; |
- 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); |
- |
rtc::scoped_refptr<webrtc::VideoEncoderConfig::EncoderSpecificSettings> |
- 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_); |
+ 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_); |
- AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_); |
+ webrtc::RtpParameters rtp_parameters_ 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 |