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

Side by Side Diff: modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h

Issue 2951033003: [EXPERIMENTAL] Generic stereo codec with index header sending single frames
Patch Set: Rebase and add external codec support. Created 3 years, 2 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 "api/video_codecs/video_encoder.h"
19 #include "media/engine/scopedvideoencoder.h"
20 #include "media/engine/webrtcvideoencoderfactory.h"
21 #include "modules/video_coding/include/video_codec_interface.h"
22
23 namespace webrtc {
24
25 enum StereoCodecStream {
26 kYUVStream = 0,
27 kAXXStream = 1,
28 kStereoCodecStreams = 2,
29 };
30
31 class StereoEncoderAdapter : public VideoEncoder {
32 public:
33 explicit StereoEncoderAdapter(cricket::WebRtcVideoEncoderFactory* factory);
34 virtual ~StereoEncoderAdapter();
35
36 // Implements VideoEncoder
37 int InitEncode(const VideoCodec* inst,
38 int number_of_cores,
39 size_t max_payload_size) override;
40 int Encode(const VideoFrame& input_image,
41 const CodecSpecificInfo* codec_specific_info,
42 const std::vector<FrameType>* frame_types) override;
43 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
44 int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
45 int SetRateAllocation(const BitrateAllocation& bitrate,
46 uint32_t new_framerate) override;
47 int Release() override;
48 const char* ImplementationName() const override {
49 return "StereoEncoderAdapter";
50 }
51
52 EncodedImageCallback::Result OnEncodedImage(
53 StereoCodecStream stream_idx,
54 const EncodedImage& encodedImage,
55 const CodecSpecificInfo* codecSpecificInfo,
56 const RTPFragmentationHeader* fragmentation);
57
58 private:
59 // Wrapper class that redirects OnEncodedImage() calls.
60 class AdapterEncodedImageCallback;
61
62 // Holds the encoded image output of a frame.
63 struct EncodedImageData;
64
65 cricket::WebRtcVideoEncoderFactory* const factory_;
66 std::vector<std::unique_ptr<VideoEncoder>> encoders_;
67 std::vector<std::unique_ptr<AdapterEncodedImageCallback>> adapter_callbacks_;
68 EncodedImageCallback* encoded_complete_callback_;
69
70 // Map timestamp.
71 std::map<uint32_t /* timestamp */, int /*count*/> frame_count_;
72
73 uint64_t picture_index_ = 0;
74 std::vector<uint8_t> merged_image_buffer_;
75 std::vector<uint8_t> stereo_dummy_planes_;
76 };
77
78 } // namespace webrtc
79
80 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698