OLD | NEW |
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 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void Restart(); | 80 void Restart(); |
81 | 81 |
82 // Codec settings. | 82 // Codec settings. |
83 uint8_t NumberOfCodecs(); | 83 uint8_t NumberOfCodecs(); |
84 int32_t GetCodec(uint8_t list_index, VideoCodec* video_codec); | 84 int32_t GetCodec(uint8_t list_index, VideoCodec* video_codec); |
85 int32_t RegisterExternalEncoder(VideoEncoder* encoder, | 85 int32_t RegisterExternalEncoder(VideoEncoder* encoder, |
86 uint8_t pl_type, | 86 uint8_t pl_type, |
87 bool internal_source); | 87 bool internal_source); |
88 int32_t DeRegisterExternalEncoder(uint8_t pl_type); | 88 int32_t DeRegisterExternalEncoder(uint8_t pl_type); |
89 int32_t SetEncoder(const VideoCodec& video_codec); | 89 int32_t SetEncoder(const VideoCodec& video_codec); |
90 int32_t GetEncoder(VideoCodec* video_codec); | |
91 | 90 |
92 // Scale or crop/pad image. | 91 // Scale or crop/pad image. |
93 int32_t ScaleInputImage(bool enable); | 92 int32_t ScaleInputImage(bool enable); |
94 | 93 |
95 // Implementing VideoCaptureCallback. | 94 // Implementing VideoCaptureCallback. |
96 void DeliverFrame(VideoFrame video_frame) override; | 95 void DeliverFrame(VideoFrame video_frame) override; |
97 | 96 |
98 int32_t SendKeyFrame(); | 97 int32_t SendKeyFrame(); |
99 | 98 |
100 uint32_t LastObservedBitrateBps() const; | 99 uint32_t LastObservedBitrateBps() const; |
101 int CodecTargetBitrate(uint32_t* bitrate) const; | 100 int CodecTargetBitrate(uint32_t* bitrate) const; |
102 // Loss protection. | 101 // Loss protection. Must be called before SetEncoder() to have max packet size |
103 int32_t UpdateProtectionMethod(bool nack, bool fec); | 102 // updated according to protection. |
104 bool nack_enabled() const { return nack_enabled_; } | 103 // TODO(pbos): Set protection method on construction or extract vcm_ outside |
| 104 // this class and set it on construction there. |
| 105 void SetProtectionMethod(bool nack, bool fec); |
105 | 106 |
106 // Buffering mode. | 107 // Buffering mode. |
107 void SetSenderBufferingMode(int target_delay_ms); | 108 void SetSenderBufferingMode(int target_delay_ms); |
108 | 109 |
109 // Implements VideoEncoderRateObserver. | 110 // Implements VideoEncoderRateObserver. |
110 void OnSetRates(uint32_t bitrate_bps, int framerate) override; | 111 void OnSetRates(uint32_t bitrate_bps, int framerate) override; |
111 | 112 |
112 // Implements VCMPacketizationCallback. | 113 // Implements VCMPacketizationCallback. |
113 int32_t SendData(uint8_t payload_type, | 114 int32_t SendData(uint8_t payload_type, |
114 const EncodedImage& encoded_image, | 115 const EncodedImage& encoded_image, |
115 const RTPFragmentationHeader& fragmentation_header, | 116 const RTPFragmentationHeader& fragmentation_header, |
116 const RTPVideoHeader* rtp_video_hdr) override; | 117 const RTPVideoHeader* rtp_video_hdr) override; |
117 | 118 |
118 // Implements VideoSendStatisticsCallback. | 119 // Implements VideoSendStatisticsCallback. |
119 int32_t SendStatistics(const uint32_t bit_rate, | 120 int32_t SendStatistics(const uint32_t bit_rate, |
120 const uint32_t frame_rate) override; | 121 const uint32_t frame_rate) override; |
121 | 122 |
122 // Implements RtcpIntraFrameObserver. | 123 // Implements RtcpIntraFrameObserver. |
123 void OnReceivedIntraFrameRequest(uint32_t ssrc) override; | 124 void OnReceivedIntraFrameRequest(uint32_t ssrc) override; |
124 void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) override; | 125 void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) override; |
125 void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) override; | 126 void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) override; |
126 void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) override; | 127 void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) override; |
127 | 128 |
128 // Sets SSRCs for all streams. | 129 // Sets SSRCs for all streams. |
129 bool SetSsrcs(const std::vector<uint32_t>& ssrcs); | 130 void SetSsrcs(const std::vector<uint32_t>& ssrcs); |
130 | 131 |
131 void SetMinTransmitBitrate(int min_transmit_bitrate_kbps); | 132 void SetMinTransmitBitrate(int min_transmit_bitrate_kbps); |
132 | 133 |
133 // Lets the sender suspend video when the rate drops below | 134 // Lets the sender suspend video when the rate drops below |
134 // |threshold_bps|, and turns back on when the rate goes back up above | 135 // |threshold_bps|, and turns back on when the rate goes back up above |
135 // |threshold_bps| + |window_bps|. | 136 // |threshold_bps| + |window_bps|. |
136 void SuspendBelowMinBitrate(); | 137 void SuspendBelowMinBitrate(); |
137 | 138 |
138 // New-style callbacks, used by VideoSendStream. | 139 // New-style callbacks, used by VideoSendStream. |
139 void RegisterPostEncodeImageCallback( | 140 void RegisterPostEncodeImageCallback( |
(...skipping 24 matching lines...) Expand all Loading... |
164 | 165 |
165 SendStatisticsProxy* const stats_proxy_; | 166 SendStatisticsProxy* const stats_proxy_; |
166 I420FrameCallback* const pre_encode_callback_; | 167 I420FrameCallback* const pre_encode_callback_; |
167 PacedSender* const pacer_; | 168 PacedSender* const pacer_; |
168 BitrateAllocator* const bitrate_allocator_; | 169 BitrateAllocator* const bitrate_allocator_; |
169 | 170 |
170 // The time we last received an input frame or encoded frame. This is used to | 171 // The time we last received an input frame or encoded frame. This is used to |
171 // track when video is stopped long enough that we also want to stop sending | 172 // track when video is stopped long enough that we also want to stop sending |
172 // padding. | 173 // padding. |
173 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); | 174 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); |
174 bool simulcast_enabled_ GUARDED_BY(data_cs_); | 175 VideoCodec encoder_config_ GUARDED_BY(data_cs_); |
175 int min_transmit_bitrate_kbps_ GUARDED_BY(data_cs_); | 176 int min_transmit_bitrate_kbps_ GUARDED_BY(data_cs_); |
176 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); | 177 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); |
177 int target_delay_ms_ GUARDED_BY(data_cs_); | 178 int target_delay_ms_ GUARDED_BY(data_cs_); |
178 bool network_is_transmitting_ GUARDED_BY(data_cs_); | 179 bool network_is_transmitting_ GUARDED_BY(data_cs_); |
179 bool encoder_paused_ GUARDED_BY(data_cs_); | 180 bool encoder_paused_ GUARDED_BY(data_cs_); |
180 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); | 181 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); |
181 std::map<unsigned int, int64_t> time_last_intra_request_ms_ | 182 std::map<unsigned int, int64_t> time_last_intra_request_ms_ |
182 GUARDED_BY(data_cs_); | 183 GUARDED_BY(data_cs_); |
183 | 184 |
184 bool fec_enabled_; | |
185 bool nack_enabled_; | |
186 | |
187 ProcessThread* module_process_thread_; | 185 ProcessThread* module_process_thread_; |
188 | 186 |
189 bool has_received_sli_ GUARDED_BY(data_cs_); | 187 bool has_received_sli_ GUARDED_BY(data_cs_); |
190 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); | 188 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); |
191 bool has_received_rpsi_ GUARDED_BY(data_cs_); | 189 bool has_received_rpsi_ GUARDED_BY(data_cs_); |
192 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 190 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
193 std::map<uint32_t, int> ssrc_streams_ GUARDED_BY(data_cs_); | 191 std::map<uint32_t, int> ssrc_streams_ GUARDED_BY(data_cs_); |
194 | 192 |
195 bool video_suspended_ GUARDED_BY(data_cs_); | 193 bool video_suspended_ GUARDED_BY(data_cs_); |
196 }; | 194 }; |
197 | 195 |
198 } // namespace webrtc | 196 } // namespace webrtc |
199 | 197 |
200 #endif // WEBRTC_VIDEO_ENGINE_VIE_ENCODER_H_ | 198 #endif // WEBRTC_VIDEO_ENGINE_VIE_ENCODER_H_ |
OLD | NEW |