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

Side by Side Diff: webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h

Issue 2558453002: Revert of H.264 packetization mode 0 (try 3) (Closed)
Patch Set: Created 4 years 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
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 * 9 *
10 */ 10 */
11 11
12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_ENCODER_IMPL_H_ 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_ENCODER_IMPL_H_
13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_ENCODER_IMPL_H_ 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_ENCODER_IMPL_H_
14 14
15 #include <memory> 15 #include <memory>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/common_video/h264/h264_bitstream_parser.h" 18 #include "webrtc/common_video/h264/h264_bitstream_parser.h"
19 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" 19 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
20 #include "webrtc/modules/video_coding/utility/quality_scaler.h" 20 #include "webrtc/modules/video_coding/utility/quality_scaler.h"
21 21
22 #include "third_party/openh264/src/codec/api/svc/codec_app_def.h" 22 #include "third_party/openh264/src/codec/api/svc/codec_app_def.h"
23 23
24 class ISVCEncoder; 24 class ISVCEncoder;
25 25
26 namespace webrtc { 26 namespace webrtc {
27 27
28 class H264EncoderImpl : public H264Encoder { 28 class H264EncoderImpl : public H264Encoder {
29 public: 29 public:
30 explicit H264EncoderImpl(const cricket::VideoCodec& codec); 30 H264EncoderImpl();
31 ~H264EncoderImpl() override; 31 ~H264EncoderImpl() override;
32 32
33 // |max_payload_size| is ignored. 33 // |max_payload_size| is ignored.
34 // The following members of |codec_settings| are used. The rest are ignored. 34 // The following members of |codec_settings| are used. The rest are ignored.
35 // - codecType (must be kVideoCodecH264) 35 // - codecType (must be kVideoCodecH264)
36 // - targetBitrate 36 // - targetBitrate
37 // - maxFramerate 37 // - maxFramerate
38 // - width 38 // - width
39 // - height 39 // - height
40 int32_t InitEncode(const VideoCodec* codec_settings, 40 int32_t InitEncode(const VideoCodec* codec_settings,
41 int32_t number_of_cores, 41 int32_t number_of_cores,
42 size_t max_payload_size) override; 42 size_t /*max_payload_size*/) override;
43 int32_t Release() override; 43 int32_t Release() override;
44 44
45 int32_t RegisterEncodeCompleteCallback( 45 int32_t RegisterEncodeCompleteCallback(
46 EncodedImageCallback* callback) override; 46 EncodedImageCallback* callback) override;
47 int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation, 47 int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation,
48 uint32_t framerate) override; 48 uint32_t framerate) override;
49 49
50 // The result of encoding - an EncodedImage and RTPFragmentationHeader - are 50 // The result of encoding - an EncodedImage and RTPFragmentationHeader - are
51 // passed to the encode complete callback. 51 // passed to the encode complete callback.
52 int32_t Encode(const VideoFrame& frame, 52 int32_t Encode(const VideoFrame& frame,
53 const CodecSpecificInfo* codec_specific_info, 53 const CodecSpecificInfo* codec_specific_info,
54 const std::vector<FrameType>* frame_types) override; 54 const std::vector<FrameType>* frame_types) override;
55 55
56 const char* ImplementationName() const override; 56 const char* ImplementationName() const override;
57 57
58 VideoEncoder::ScalingSettings GetScalingSettings() const override; 58 VideoEncoder::ScalingSettings GetScalingSettings() const override;
59 59
60 // Unsupported / Do nothing. 60 // Unsupported / Do nothing.
61 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; 61 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
62 int32_t SetPeriodicKeyFrames(bool enable) override; 62 int32_t SetPeriodicKeyFrames(bool enable) override;
63 63
64 // Exposed for testing.
65 H264PacketizationMode PacketizationModeForTesting() const {
66 return packetization_mode_;
67 }
68
69 private: 64 private:
70 bool IsInitialized() const; 65 bool IsInitialized() const;
71 SEncParamExt CreateEncoderParams() const; 66 SEncParamExt CreateEncoderParams() const;
72 67
73 webrtc::H264BitstreamParser h264_bitstream_parser_; 68 webrtc::H264BitstreamParser h264_bitstream_parser_;
74 // Reports statistics with histograms. 69 // Reports statistics with histograms.
75 void ReportInit(); 70 void ReportInit();
76 void ReportError(); 71 void ReportError();
77 72
78 ISVCEncoder* openh264_encoder_; 73 ISVCEncoder* openh264_encoder_;
79 // Settings that are used by this encoder. 74 // Settings that are used by this encoder.
80 int width_; 75 int width_;
81 int height_; 76 int height_;
82 float max_frame_rate_; 77 float max_frame_rate_;
83 uint32_t target_bps_; 78 uint32_t target_bps_;
84 uint32_t max_bps_; 79 uint32_t max_bps_;
85 VideoCodecMode mode_; 80 VideoCodecMode mode_;
86 // H.264 specifc parameters 81 // H.264 specifc parameters
87 bool frame_dropping_on_; 82 bool frame_dropping_on_;
88 int key_frame_interval_; 83 int key_frame_interval_;
89 H264PacketizationMode packetization_mode_;
90 84
91 size_t max_payload_size_;
92 int32_t number_of_cores_; 85 int32_t number_of_cores_;
93 86
94 EncodedImage encoded_image_; 87 EncodedImage encoded_image_;
95 std::unique_ptr<uint8_t[]> encoded_image_buffer_; 88 std::unique_ptr<uint8_t[]> encoded_image_buffer_;
96 EncodedImageCallback* encoded_image_callback_; 89 EncodedImageCallback* encoded_image_callback_;
97 90
98 bool has_reported_init_; 91 bool has_reported_init_;
99 bool has_reported_error_; 92 bool has_reported_error_;
100 }; 93 };
101 94
102 } // namespace webrtc 95 } // namespace webrtc
103 96
104 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_ENCODER_IMPL_H_ 97 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_ENCODER_IMPL_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/h264/h264.cc ('k') | webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698