| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 // Drops incoming packets before they get to the encoder. | 72 // Drops incoming packets before they get to the encoder. |
| 73 void Pause(); | 73 void Pause(); |
| 74 void Restart(); | 74 void Restart(); |
| 75 | 75 |
| 76 // Codec settings. | 76 // Codec settings. |
| 77 int32_t RegisterExternalEncoder(VideoEncoder* encoder, | 77 int32_t RegisterExternalEncoder(VideoEncoder* encoder, |
| 78 uint8_t pl_type, | 78 uint8_t pl_type, |
| 79 bool internal_source); | 79 bool internal_source); |
| 80 int32_t DeRegisterExternalEncoder(uint8_t pl_type); | 80 int32_t DeRegisterExternalEncoder(uint8_t pl_type); |
| 81 void SetEncoder(const VideoCodec& video_codec); | 81 void SetEncoder(const VideoCodec& video_codec, int min_transmit_bitrate_bps); |
| 82 | 82 |
| 83 // Implementing VideoCaptureCallback. | 83 // Implementing VideoCaptureCallback. |
| 84 void DeliverFrame(VideoFrame video_frame) override; | 84 void DeliverFrame(VideoFrame video_frame) override; |
| 85 | 85 |
| 86 void SendKeyFrame(); | 86 void SendKeyFrame(); |
| 87 | 87 |
| 88 uint32_t LastObservedBitrateBps() const; | 88 uint32_t LastObservedBitrateBps() const; |
| 89 int CodecTargetBitrate(uint32_t* bitrate) const; | 89 int CodecTargetBitrate(uint32_t* bitrate) const; |
| 90 // Loss protection. Must be called before SetEncoder() to have max packet size | 90 // Loss protection. Must be called before SetEncoder() to have max packet size |
| 91 // updated according to protection. | 91 // updated according to protection. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 105 | 105 |
| 106 // Implements VideoSendStatisticsCallback. | 106 // Implements VideoSendStatisticsCallback. |
| 107 int32_t SendStatistics(const uint32_t bit_rate, | 107 int32_t SendStatistics(const uint32_t bit_rate, |
| 108 const uint32_t frame_rate) override; | 108 const uint32_t frame_rate) override; |
| 109 | 109 |
| 110 // virtual to test EncoderStateFeedback with mocks. | 110 // virtual to test EncoderStateFeedback with mocks. |
| 111 virtual void OnReceivedIntraFrameRequest(uint32_t ssrc); | 111 virtual void OnReceivedIntraFrameRequest(uint32_t ssrc); |
| 112 virtual void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id); | 112 virtual void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id); |
| 113 virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id); | 113 virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id); |
| 114 | 114 |
| 115 void SetMinTransmitBitrate(int min_transmit_bitrate_kbps); | |
| 116 | |
| 117 // Lets the sender suspend video when the rate drops below | 115 // Lets the sender suspend video when the rate drops below |
| 118 // |threshold_bps|, and turns back on when the rate goes back up above | 116 // |threshold_bps|, and turns back on when the rate goes back up above |
| 119 // |threshold_bps| + |window_bps|. | 117 // |threshold_bps| + |window_bps|. |
| 120 void SuspendBelowMinBitrate(); | 118 void SuspendBelowMinBitrate(); |
| 121 | 119 |
| 122 // New-style callbacks, used by VideoSendStream. | 120 // New-style callbacks, used by VideoSendStream. |
| 123 void RegisterPostEncodeImageCallback( | 121 void RegisterPostEncodeImageCallback( |
| 124 EncodedImageCallback* post_encode_callback); | 122 EncodedImageCallback* post_encode_callback); |
| 125 | 123 |
| 126 int GetPaddingNeededBps() const; | 124 int GetPaddingNeededBps() const; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 151 OveruseFrameDetector* const overuse_detector_; | 149 OveruseFrameDetector* const overuse_detector_; |
| 152 PacedSender* const pacer_; | 150 PacedSender* const pacer_; |
| 153 PayloadRouter* const send_payload_router_; | 151 PayloadRouter* const send_payload_router_; |
| 154 BitrateAllocator* const bitrate_allocator_; | 152 BitrateAllocator* const bitrate_allocator_; |
| 155 | 153 |
| 156 // The time we last received an input frame or encoded frame. This is used to | 154 // The time we last received an input frame or encoded frame. This is used to |
| 157 // track when video is stopped long enough that we also want to stop sending | 155 // track when video is stopped long enough that we also want to stop sending |
| 158 // padding. | 156 // padding. |
| 159 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); | 157 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); |
| 160 VideoCodec encoder_config_ GUARDED_BY(data_cs_); | 158 VideoCodec encoder_config_ GUARDED_BY(data_cs_); |
| 161 int min_transmit_bitrate_kbps_ GUARDED_BY(data_cs_); | 159 int min_transmit_bitrate_bps_ GUARDED_BY(data_cs_); |
| 162 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); | 160 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); |
| 163 bool network_is_transmitting_ GUARDED_BY(data_cs_); | 161 bool network_is_transmitting_ GUARDED_BY(data_cs_); |
| 164 bool encoder_paused_ GUARDED_BY(data_cs_); | 162 bool encoder_paused_ GUARDED_BY(data_cs_); |
| 165 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); | 163 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); |
| 166 std::vector<int64_t> time_last_intra_request_ms_ GUARDED_BY(data_cs_); | 164 std::vector<int64_t> time_last_intra_request_ms_ GUARDED_BY(data_cs_); |
| 167 | 165 |
| 168 ProcessThread* module_process_thread_; | 166 ProcessThread* module_process_thread_; |
| 169 | 167 |
| 170 bool has_received_sli_ GUARDED_BY(data_cs_); | 168 bool has_received_sli_ GUARDED_BY(data_cs_); |
| 171 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); | 169 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); |
| 172 bool has_received_rpsi_ GUARDED_BY(data_cs_); | 170 bool has_received_rpsi_ GUARDED_BY(data_cs_); |
| 173 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 171 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
| 174 | 172 |
| 175 bool video_suspended_ GUARDED_BY(data_cs_); | 173 bool video_suspended_ GUARDED_BY(data_cs_); |
| 176 }; | 174 }; |
| 177 | 175 |
| 178 } // namespace webrtc | 176 } // namespace webrtc |
| 179 | 177 |
| 180 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 178 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
| OLD | NEW |