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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTER_H _
12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTER_H _
13
14 #include <map>
15 #include <memory>
16 #include <vector>
17
18 #include "webrtc/api/video_codecs/video_encoder.h"
19 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
20
21 namespace webrtc {
22
23 enum StereoCodecStream {
24 kYUVStream = 0,
25 kAXXStream = 1,
26 kStereoCodecStreams = 2,
27 };
28
29 class StereoEncoderAdapter : public VideoEncoder {
30 public:
31 explicit StereoEncoderAdapter(VideoEncoderFactory* factory);
32 virtual ~StereoEncoderAdapter();
33
34 // Implements VideoEncoder
35 int InitEncode(const VideoCodec* inst,
36 int number_of_cores,
37 size_t max_payload_size) override;
38 int Encode(const VideoFrame& input_image,
39 const CodecSpecificInfo* codec_specific_info,
40 const std::vector<FrameType>* frame_types) override;
41 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
42 int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
43 int SetRateAllocation(const BitrateAllocation& bitrate,
44 uint32_t new_framerate) override;
45 int Release() override;
46 const char* ImplementationName() const override {
47 return "StereoEncoderAdapter";
48 }
49
50 EncodedImageCallback::Result OnEncodedImage(
51 StereoCodecStream stream_idx,
52 const EncodedImage& encodedImage,
53 const CodecSpecificInfo* codecSpecificInfo,
54 const RTPFragmentationHeader* fragmentation);
55
56 private:
57 // Wrapper class that redirects OnEncodedImage() calls.
58 class AdapterEncodedImageCallback;
59
60 // Holds the encoded image output of a frame.
61 struct EncodedImageData;
62
63 EncodedImageCallback::Result SendEncodedImages(
64 const EncodedImage& encoded_image,
65 const CodecSpecificInfo* codec_specific_info,
66 const RTPFragmentationHeader* fragmentation,
67 const EncodedImage& stereo_encoded_image,
68 const CodecSpecificInfo* stereo_codec_specific_info,
69 const RTPFragmentationHeader* stereo_fragmentation);
70
71 std::unique_ptr<VideoEncoderFactory> factory_;
72 std::vector<VideoEncoder*> encoders_;
73 std::vector<std::unique_ptr<AdapterEncodedImageCallback>> adapter_callbacks_;
74 EncodedImageCallback* encoded_complete_callback_;
75
76 // Holds YUV or AXX encode output of a frame that is identified by timestamp.
77 std::map<uint32_t /* timestamp */, EncodedImageData> encoded_data_;
78
79 std::vector<uint8_t> merged_image_buffer_;
80 std::vector<uint8_t> stereo_dummy_planes_;
81 };
82
83 } // namespace webrtc
84
85 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698