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

Unified Diff: webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h

Issue 1913073002: Extract common simulcast logic from VP8 wrapper and simulcast adapter (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address comments, added tests Created 4 years, 7 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
Index: webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h
diff --git a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h
index fca16df6fad4bd61b0f17f9b618076c8005308c1..4ff80cccecd800ddda956e7b3d38d4da71483b2e 100644
--- a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h
+++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h
@@ -12,14 +12,19 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_
+#include <map>
#include <memory>
#include <string>
+#include <utility>
#include <vector>
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
+#include "webrtc/modules/video_coding/utility/simulcast_state.h"
namespace webrtc {
+class SimulcastState;
+
class VideoEncoderFactory {
public:
virtual VideoEncoder* Create() = 0;
@@ -63,56 +68,28 @@ class SimulcastEncoderAdapter : public VP8Encoder {
private:
struct StreamInfo {
- StreamInfo()
- : encoder(NULL),
- callback(NULL),
- width(0),
- height(0),
- key_frame_request(false),
- send_stream(true) {}
+ StreamInfo() : encoder(nullptr), callback(nullptr), width(0), height(0) {}
StreamInfo(VideoEncoder* encoder,
EncodedImageCallback* callback,
uint16_t width,
- uint16_t height,
- bool send_stream)
- : encoder(encoder),
- callback(callback),
- width(width),
- height(height),
- key_frame_request(false),
- send_stream(send_stream) {}
+ uint16_t height)
+ : encoder(encoder), callback(callback), width(width), height(height) {}
// Deleted by SimulcastEncoderAdapter::Release().
VideoEncoder* encoder;
EncodedImageCallback* callback;
uint16_t width;
uint16_t height;
- bool key_frame_request;
- bool send_stream;
};
- // Get the stream bitrate, for the stream |stream_idx|, given the bitrate
- // |new_bitrate_kbit| and the actual configured stream count in
- // |total_number_of_streams|. The function also returns whether there's enough
- // bandwidth to send this stream via |send_stream|.
- uint32_t GetStreamBitrate(int stream_idx,
- size_t total_number_of_streams,
- uint32_t new_bitrate_kbit,
- bool* send_stream) const;
-
- // Populate the codec settings for each stream.
- void PopulateStreamCodec(const webrtc::VideoCodec* inst,
- int stream_index,
- size_t total_number_of_streams,
- bool highest_resolution_stream,
- webrtc::VideoCodec* stream_codec,
- bool* send_stream);
-
bool Initialized() const;
std::unique_ptr<VideoEncoderFactory> factory_;
std::unique_ptr<TemporalLayersFactory> screensharing_tl_factory_;
VideoCodec codec_;
- std::vector<StreamInfo> streaminfos_;
+ SimulcastState stream_states_;
+ typedef std::pair<VideoEncoder*, std::unique_ptr<EncodedImageCallback>>
+ EncoderContext;
+ std::map<uint8_t, EncoderContext> encoders_;
EncodedImageCallback* encoded_complete_callback_;
std::string implementation_name_;
};

Powered by Google App Engine
This is Rietveld 408576698