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

Unified Diff: webrtc/modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h

Issue 2990463002: [EXPERIMENTAL] Generic stereo codec with index header sending merged frames
Patch Set: Created 3 years, 5 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/stereo/include/stereo_encoder_adapter.h
diff --git a/webrtc/modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h b/webrtc/modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a5f31f8f578189ebc37781a13eab55bcba2602c0
--- /dev/null
+++ b/webrtc/modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTER_H_
+#define WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTER_H_
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include "webrtc/api/video_codecs/video_encoder.h"
+#include "webrtc/modules/video_coding/include/video_codec_interface.h"
+
+namespace webrtc {
+
+enum StereoCodecStream {
+ kYUVStream = 0,
+ kAXXStream = 1,
+ kStereoCodecStreams = 2,
+};
+
+class StereoEncoderAdapter : public VideoEncoder {
+ public:
+ explicit StereoEncoderAdapter(VideoEncoderFactory* factory);
+ virtual ~StereoEncoderAdapter();
+
+ // Implements VideoEncoder
+ int InitEncode(const VideoCodec* inst,
+ int number_of_cores,
+ size_t max_payload_size) override;
+ int Encode(const VideoFrame& input_image,
+ const CodecSpecificInfo* codec_specific_info,
+ const std::vector<FrameType>* frame_types) override;
+ int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
+ int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
+ int SetRateAllocation(const BitrateAllocation& bitrate,
+ uint32_t new_framerate) override;
+ int Release() override;
+ const char* ImplementationName() const override {
+ return "StereoEncoderAdapter";
+ }
+
+ EncodedImageCallback::Result OnEncodedImage(
+ StereoCodecStream stream_idx,
+ const EncodedImage& encodedImage,
+ const CodecSpecificInfo* codecSpecificInfo,
+ const RTPFragmentationHeader* fragmentation);
+
+ private:
+ // Wrapper class that redirects OnEncodedImage() calls.
+ class AdapterEncodedImageCallback;
+
+ // Holds the encoded image output of a frame.
+ struct EncodedImageData;
+
+ EncodedImageCallback::Result SendEncodedImages(
+ const EncodedImage& encoded_image,
+ const CodecSpecificInfo* codec_specific_info,
+ const RTPFragmentationHeader* fragmentation,
+ const EncodedImage& stereo_encoded_image,
+ const CodecSpecificInfo* stereo_codec_specific_info,
+ const RTPFragmentationHeader* stereo_fragmentation);
+
+ std::unique_ptr<VideoEncoderFactory> factory_;
+ std::vector<VideoEncoder*> encoders_;
+ std::vector<std::unique_ptr<AdapterEncodedImageCallback>> adapter_callbacks_;
+ EncodedImageCallback* encoded_complete_callback_;
+
+ // Holds YUV or AXX encode output of a frame that is identified by timestamp.
+ std::map<uint32_t /* timestamp */, EncodedImageData> encoded_data_;
+
+ std::vector<uint8_t> merged_image_buffer_;
+ std::vector<uint8_t> stereo_dummy_planes_;
+};
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTER_H_

Powered by Google App Engine
This is Rietveld 408576698