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

Unified Diff: webrtc/config.h

Issue 2047513002: Add proper lifetime of encoder-specific settings. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback Created 4 years, 4 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
« no previous file with comments | « no previous file | webrtc/config.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/config.h
diff --git a/webrtc/config.h b/webrtc/config.h
index 1550a9f8a13ac1b121c90b31a771eee56e12f1a6..f5eaa604a031410651952ff3118fad58c74cf8a3 100644
--- a/webrtc/config.h
+++ b/webrtc/config.h
@@ -17,6 +17,8 @@
#include <vector>
#include "webrtc/base/optional.h"
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/common.h"
#include "webrtc/common_types.h"
#include "webrtc/typedefs.h"
@@ -125,6 +127,51 @@ struct VideoStream {
};
struct VideoEncoderConfig {
+ // These are reference counted to permit copying VideoEncoderConfig and be
+ // kept alive until all encoder_specific_settings go out of scope.
+ // TODO(pbos): Consider removing the need for copying VideoEncoderConfig and
+ // use a rtc::Optional for encoder_specific_settings instead.
+ class EncoderSpecificSettings : public rtc::RefCountInterface {
perkj_webrtc 2016/09/14 09:51:31 I really think this should be landed. But I think
+ public:
+ virtual ~EncoderSpecificSettings() {}
+ // TODO(pbos): Remove FillEncoderSpecificSettings as soon as VideoCodec is
+ // not in use and encoder implementations ask for codec-specific structs
+ // directly.
+ void FillEncoderSpecificSettings(VideoCodec* codec_struct) const;
+
+ virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const;
+ virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const;
+ virtual void FillVideoCodecH264(VideoCodecH264* h264_settings) const;
+ };
+
+ class H264EncoderSpecificSettings : public EncoderSpecificSettings {
+ public:
+ explicit H264EncoderSpecificSettings(const VideoCodecH264& specifics);
+ virtual void FillVideoCodecH264(
+ VideoCodecH264* h264_settings) const override;
+
+ private:
+ VideoCodecH264 specifics_;
+ };
+
+ class Vp8EncoderSpecificSettings : public EncoderSpecificSettings {
+ public:
+ explicit Vp8EncoderSpecificSettings(const VideoCodecVP8& specifics);
+ virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const override;
+
+ private:
+ VideoCodecVP8 specifics_;
+ };
+
+ class Vp9EncoderSpecificSettings : public EncoderSpecificSettings {
+ public:
+ explicit Vp9EncoderSpecificSettings(const VideoCodecVP9& specifics);
+ virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const override;
+
+ private:
+ VideoCodecVP9 specifics_;
+ };
+
enum class ContentType {
kRealtimeVideo,
kScreen,
@@ -137,7 +184,7 @@ struct VideoEncoderConfig {
std::vector<VideoStream> streams;
std::vector<SpatialLayer> spatial_layers;
ContentType content_type;
- void* encoder_specific_settings;
+ rtc::scoped_refptr<const EncoderSpecificSettings> encoder_specific_settings;
// Padding will be used up to this bitrate regardless of the bitrate produced
// by the encoder. Padding above what's actually produced by the encoder helps
« no previous file with comments | « no previous file | webrtc/config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698