Index: webrtc/media/engine/webrtcvideoengine.h |
diff --git a/webrtc/media/engine/webrtcvideoengine.h b/webrtc/media/engine/webrtcvideoengine.h |
index 64581dc061e342333085d6cf5984460990f238ff..caca11c1fffb5a696b302d7130c03daaf8257a17 100644 |
--- a/webrtc/media/engine/webrtcvideoengine.h |
+++ b/webrtc/media/engine/webrtcvideoengine.h |
@@ -122,7 +122,6 @@ class WebRtcVideoEngine { |
WebRtcVideoDecoderFactory* external_decoder_factory_; |
WebRtcVideoEncoderFactory* external_encoder_factory_; |
- std::unique_ptr<WebRtcVideoEncoderFactory> simulcast_encoder_factory_; |
}; |
class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport { |
@@ -311,24 +310,46 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport { |
webrtc::VideoEncoderConfig encoder_config; |
}; |
- struct AllocatedEncoder { |
- AllocatedEncoder(webrtc::VideoEncoder* encoder, |
+ class AllocatedEncoder { |
+ public: |
+ AllocatedEncoder() = default; |
+ AllocatedEncoder(AllocatedEncoder&&) = default; |
+ AllocatedEncoder& operator=(AllocatedEncoder&&) = default; |
+ |
+ AllocatedEncoder(std::unique_ptr<webrtc::VideoEncoder> encoder, |
+ std::unique_ptr<webrtc::VideoEncoder> external_encoder, |
const cricket::VideoCodec& codec, |
- bool external); |
- webrtc::VideoEncoder* encoder; |
- webrtc::VideoEncoder* external_encoder; |
- cricket::VideoCodec codec; |
- bool external; |
+ bool has_internal_source); |
+ |
+ // Returns a raw pointer to the allocated encoder. This object still has |
+ // ownership of the encoder and is responsible for deleting it. |
+ webrtc::VideoEncoder* encoder() { return encoder_.get(); } |
+ |
+ // Returns true if the encoder is external. |
+ bool IsExternal() { return static_cast<bool>(external_encoder_); } |
+ |
+ cricket::VideoCodec codec() { return codec_; } |
+ |
+ bool HasInternalSource() { return has_internal_source_; } |
+ |
+ // Release the encoders this object manages. |
+ void Reset(); |
+ |
+ private: |
+ std::unique_ptr<webrtc::VideoEncoder> encoder_; |
+ // TODO(magjed): |external_encoder_| is not used except for managing |
+ // the lifetime when we use VideoEncoderSoftwareFallbackWrapper. Let |
+ // VideoEncoderSoftwareFallbackWrapper own the external encoder instead |
+ // and remove this member variable. |
+ std::unique_ptr<webrtc::VideoEncoder> external_encoder_; |
+ cricket::VideoCodec codec_; |
+ bool has_internal_source_; |
}; |
rtc::scoped_refptr<webrtc::VideoEncoderConfig::EncoderSpecificSettings> |
ConfigureVideoEncoderSettings(const VideoCodec& codec); |
- // If force_encoder_allocation is true, a new AllocatedEncoder is always |
- // created. If false, the allocated encoder may be reused, if the type |
- // matches. |
- AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec, |
- bool force_encoder_allocation); |
- void DestroyVideoEncoder(AllocatedEncoder* encoder); |
+ // Creates and returns a new AllocatedEncoder of the specified codec type. |
+ AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec); |
void SetCodec(const VideoCodecSettings& codec, |
bool force_encoder_allocation); |
void RecreateWebRtcStream(); |