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..4ceb5685011eb99f63d6a88b1106f74c28688b6a 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,39 @@ 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) { |
+ timing_frames_thresholds_ = thresholds; |
+ } |
+ |
private: |
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_; |
+ size_t framerate_; |
+ int64_t last_timing_frame_time_ms_; |
+ VideoCodec::TimingFrameTriggerThresholds timing_frames_thresholds_; |
sprang_webrtc
2017/06/09 11:02:01
Looks like there are potential raciness here, as r
ilnik
2017/06/09 12:06:05
I think, there's no raciness here, as most methods
sprang_webrtc
2017/06/12 07:10:10
OnEncodedImage() is called by the encoder, but the
ilnik
2017/06/12 09:06:24
Ok, Added protection using critical section.
|
}; |
sprang_webrtc
2017/06/09 11:02:01
This logic definitely warrants units tests as well
ilnik
2017/06/09 12:06:06
I am writing a second CL with tests in parallel. G
sprang_webrtc
2017/06/12 07:10:10
I'd actually prefer they are in the same one. If i
ilnik
2017/06/12 09:06:24
Working on it.
ilnik
2017/06/12 10:08:50
Added generic_encoder_unittests and also another t
|
class VCMGenericEncoder { |
@@ -88,6 +114,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 |