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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.h

Issue 2434073003: Extract bitrate allocation of spatial/temporal layers out of codec impl. (Closed)
Patch Set: Updated tl listener registration. Fixed tests. Created 4 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
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 * WEBRTC VP8 wrapper interface 10 * WEBRTC VP8 wrapper interface
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 int Encode(const VideoFrame& input_image, 50 int Encode(const VideoFrame& input_image,
51 const CodecSpecificInfo* codec_specific_info, 51 const CodecSpecificInfo* codec_specific_info,
52 const std::vector<FrameType>* frame_types) override; 52 const std::vector<FrameType>* frame_types) override;
53 53
54 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; 54 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
55 55
56 int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; 56 int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
57 57
58 int SetRates(uint32_t new_bitrate_kbit, uint32_t frame_rate) override; 58 int SetRates(uint32_t new_bitrate_kbit, uint32_t frame_rate) override;
59 int SetRateAllocation(const BitrateAllocation& bitrate,
60 uint32_t new_framerate) override;
59 61
60 void OnDroppedFrame() override; 62 void OnDroppedFrame() override;
61 63
62 const char* ImplementationName() const override; 64 const char* ImplementationName() const override;
63 65
64 private: 66 private:
65 void SetupTemporalLayers(int num_streams, 67 void SetupTemporalLayers(int num_streams,
66 int num_temporal_layers, 68 int num_temporal_layers,
67 const VideoCodec& codec); 69 const VideoCodec& codec,
70 SimulcastRateAllocator* allocator);
68 71
69 // Set the cpu_speed setting for encoder based on resolution and/or platform. 72 // Set the cpu_speed setting for encoder based on resolution and/or platform.
70 int SetCpuSpeed(int width, int height); 73 int SetCpuSpeed(int width, int height);
71 74
72 // Determine number of encoder threads to use. 75 // Determine number of encoder threads to use.
73 int NumberOfThreads(int width, int height, int number_of_cores); 76 int NumberOfThreads(int width, int height, int number_of_cores);
74 77
75 // Call encoder initialize function and set control settings. 78 // Call encoder initialize function and set control settings.
76 int InitAndSetControlSettings(); 79 int InitAndSetControlSettings();
77 80
78 // Update frame size for codec. 81 // Update frame size for codec.
79 int UpdateCodecFrameSize(int width, int height); 82 int UpdateCodecFrameSize(int width, int height);
80 83
81 void PopulateCodecSpecific(CodecSpecificInfo* codec_specific, 84 void PopulateCodecSpecific(CodecSpecificInfo* codec_specific,
82 const vpx_codec_cx_pkt& pkt, 85 const vpx_codec_cx_pkt& pkt,
83 int stream_idx, 86 int stream_idx,
84 uint32_t timestamp, 87 uint32_t timestamp,
85 bool only_predicting_from_key_frame); 88 bool only_predicting_from_key_frame);
86 89
87 int GetEncodedPartitions(const VideoFrame& input_image, 90 int GetEncodedPartitions(const VideoFrame& input_image,
88 bool only_predicting_from_key_frame); 91 bool only_predicting_from_key_frame);
89 92
90 // Set the stream state for stream |stream_idx|. 93 // Set the stream state for stream |stream_idx|.
91 void SetStreamState(bool send_stream, int stream_idx); 94 void SetStreamState(bool send_stream, int stream_idx);
92 95
93 uint32_t MaxIntraTarget(uint32_t optimal_buffer_size); 96 uint32_t MaxIntraTarget(uint32_t optimal_buffer_size);
94 97
95 EncodedImageCallback* encoded_complete_callback_; 98 EncodedImageCallback* encoded_complete_callback_;
96 VideoCodec codec_; 99 VideoCodec codec_;
97 std::unique_ptr<SimulcastRateAllocator> rate_allocator_; 100 std::unique_ptr<SimulcastRateAllocator> fallback_rate_allocator_;
101 std::unique_ptr<TemporalLayersFactory> fallback_tl_factory_;
98 bool inited_; 102 bool inited_;
99 int64_t timestamp_; 103 int64_t timestamp_;
100 bool feedback_mode_; 104 bool feedback_mode_;
101 int qp_max_; 105 int qp_max_;
102 int cpu_speed_default_; 106 int cpu_speed_default_;
103 uint32_t rc_max_intra_target_; 107 uint32_t rc_max_intra_target_;
104 int token_partitions_; 108 int token_partitions_;
105 ReferencePictureSelection rps_; 109 ReferencePictureSelection rps_;
106 std::vector<TemporalLayers*> temporal_layers_; 110 std::vector<TemporalLayers*> temporal_layers_;
107 bool down_scale_requested_; 111 bool down_scale_requested_;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 int image_format_; 165 int image_format_;
162 vpx_ref_frame_t* ref_frame_; 166 vpx_ref_frame_t* ref_frame_;
163 int propagation_cnt_; 167 int propagation_cnt_;
164 int last_frame_width_; 168 int last_frame_width_;
165 int last_frame_height_; 169 int last_frame_height_;
166 bool key_frame_required_; 170 bool key_frame_required_;
167 }; // end of VP8DecoderImpl class 171 }; // end of VP8DecoderImpl class
168 } // namespace webrtc 172 } // namespace webrtc
169 173
170 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_VP8_IMPL_H_ 174 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_VP8_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698