| Index: webrtc/media/engine/webrtcvideoengine2.h
|
| diff --git a/webrtc/media/engine/webrtcvideoengine2.h b/webrtc/media/engine/webrtcvideoengine2.h
|
| index 38e0eaa4457e56843bff873132baaa8a74a43f82..2ad4ed85845c1941cbfcd6a437bcfcb260a2ad6f 100644
|
| --- a/webrtc/media/engine/webrtcvideoengine2.h
|
| +++ b/webrtc/media/engine/webrtcvideoengine2.h
|
| @@ -320,13 +320,17 @@
|
| 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(0),
|
| - height(0),
|
| + : width(176),
|
| + height(144),
|
| rotation(webrtc::kVideoRotation_0),
|
| is_texture(false) {}
|
| int width;
|
| @@ -335,63 +339,79 @@
|
| 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);
|
| - AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec);
|
| - void DestroyVideoEncoder(AllocatedEncoder* encoder);
|
| - void SetCodec(const VideoCodecSettings& codec);
|
| - void RecreateWebRtcStream();
|
| + 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_);
|
| webrtc::VideoEncoderConfig CreateVideoEncoderConfig(
|
| - const VideoCodec& codec) const;
|
| - void ReconfigureEncoder();
|
| + const VideoCodec& codec) const EXCLUSIVE_LOCKS_REQUIRED(lock_);
|
| + void ReconfigureEncoder() EXCLUSIVE_LOCKS_REQUIRED(lock_);
|
| 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();
|
| + void UpdateSendState() EXCLUSIVE_LOCKS_REQUIRED(lock_);
|
|
|
| void UpdateHistograms() const EXCLUSIVE_LOCKS_REQUIRED(lock_);
|
|
|
| rtc::ThreadChecker thread_checker_;
|
| rtc::AsyncInvoker invoker_;
|
| rtc::Thread* worker_thread_;
|
| - const std::vector<uint32_t> ssrcs_ ACCESS_ON(&thread_checker_);
|
| - const std::vector<SsrcGroup> ssrc_groups_ ACCESS_ON(&thread_checker_);
|
| + const std::vector<uint32_t> ssrcs_;
|
| + const std::vector<SsrcGroup> ssrc_groups_;
|
| webrtc::Call* const call_;
|
| - rtc::VideoSinkWants sink_wants_ ACCESS_ON(&thread_checker_);
|
| + rtc::VideoSinkWants sink_wants_;
|
| // 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_ ACCESS_ON(&thread_checker_);
|
| + int number_of_cpu_adapt_changes_;
|
| // 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_
|
| - ACCESS_ON(&thread_checker_);
|
| + rtc::VideoSourceInterface<cricket::VideoFrame>* source_;
|
| WebRtcVideoEncoderFactory* const external_encoder_factory_
|
| - ACCESS_ON(&thread_checker_);
|
| + GUARDED_BY(lock_);
|
|
|
| rtc::CriticalSection lock_;
|
| - webrtc::VideoSendStream* stream_ ACCESS_ON(&thread_checker_);
|
| + webrtc::VideoSendStream* stream_ GUARDED_BY(lock_);
|
| 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_ ACCESS_ON(&thread_checker_);
|
| + VideoSendStreamParameters parameters_ GUARDED_BY(lock_);
|
| // 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_ ACCESS_ON(&thread_checker_);
|
| - AllocatedEncoder allocated_encoder_ ACCESS_ON(&thread_checker_);
|
| + webrtc::RtpParameters rtp_parameters_ GUARDED_BY(lock_);
|
| + bool pending_encoder_reconfiguration_ GUARDED_BY(lock_);
|
| + AllocatedEncoder allocated_encoder_ GUARDED_BY(lock_);
|
| VideoFrameInfo last_frame_info_ GUARDED_BY(lock_);
|
|
|
| - bool sending_ ACCESS_ON(&thread_checker_);
|
| + bool sending_ GUARDED_BY(lock_);
|
|
|
| // The timestamp of the last frame received
|
| // Used to generate timestamp for the black frame when source is removed
|
|
|