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

Unified Diff: webrtc/modules/video_coding/generic_encoder.h

Issue 2911193002: Implement timing frames. (Closed)
Patch Set: Implement Holmer@ comments Created 3 years, 6 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 | « webrtc/modules/video_coding/generic_decoder.cc ('k') | webrtc/modules/video_coding/generic_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/generic_encoder.h
diff --git a/webrtc/modules/video_coding/generic_encoder.h b/webrtc/modules/video_coding/generic_encoder.h
index 939d8b0fb2311df0ee54c5e210ccf211ec6c393e..8b33246eb95171a730ffd58a0a692236cc42549d 100644
--- a/webrtc/modules/video_coding/generic_encoder.h
+++ b/webrtc/modules/video_coding/generic_encoder.h
@@ -12,6 +12,7 @@
#define WEBRTC_MODULES_VIDEO_CODING_GENERIC_ENCODER_H_
#include <stdio.h>
+#include <map>
#include <vector>
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
@@ -44,14 +45,43 @@ class VCMEncodedFrameCallback : public EncodedImageCallback {
const EncodedImage& encoded_image,
const CodecSpecificInfo* codec_specific_info,
const RTPFragmentationHeader* fragmentation) override;
+
void SetInternalSource(bool internal_source) {
internal_source_ = internal_source;
}
+ // Timing frames configuration methods. These 4 should be called before
+ // |OnEncodedImage| at least once.
+ void OnTargetBitrateChanged(size_t bitrate_bytes_per_sec,
+ size_t simulcast_svc_idx);
+
+ void OnFrameRateChanged(size_t framerate);
+
+ void OnEncodeStarted(int64_t capture_time_ms, size_t simulcast_svc_idx);
+
+ void SetTimingFramesThresholds(
+ const VideoCodec::TimingFrameTriggerThresholds& thresholds) {
+ rtc::CritScope crit(&timing_params_lock_);
+ timing_frames_thresholds_ = thresholds;
+ }
+
private:
+ rtc::CriticalSection timing_params_lock_;
bool internal_source_;
EncodedImageCallback* const post_encode_callback_;
media_optimization::MediaOptimization* const media_opt_;
+
+ struct TimingFramesLayerInfo {
+ size_t target_bitrate_bytes_per_sec = 0;
+ std::map<int64_t, int64_t> encode_start_time_ms;
+ };
+ // Separate instance for each simulcast stream or spatial layer.
+ std::vector<TimingFramesLayerInfo> timing_frames_info_
+ GUARDED_BY(timing_params_lock_);
+ size_t framerate_ GUARDED_BY(timing_params_lock_);
+ int64_t last_timing_frame_time_ms_ GUARDED_BY(timing_params_lock_);
+ VideoCodec::TimingFrameTriggerThresholds timing_frames_thresholds_
+ GUARDED_BY(timing_params_lock_);
};
class VCMGenericEncoder {
@@ -88,6 +118,7 @@ class VCMGenericEncoder {
rtc::CriticalSection params_lock_;
EncoderParameters encoder_params_ GUARDED_BY(params_lock_);
bool is_screenshare_;
+ size_t streams_or_svc_num_;
};
} // namespace webrtc
« no previous file with comments | « webrtc/modules/video_coding/generic_decoder.cc ('k') | webrtc/modules/video_coding/generic_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698