| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // VieEncoder represent a video encoder that accepts raw video frames as input | 42 // VieEncoder represent a video encoder that accepts raw video frames as input |
| 43 // and produces an encoded bit stream. | 43 // and produces an encoded bit stream. |
| 44 // Usage: | 44 // Usage: |
| 45 // 1. Instantiate | 45 // 1. Instantiate |
| 46 // 2. Call Init | 46 // 2. Call Init |
| 47 // 3. Call RegisterExternalEncoder if available. | 47 // 3. Call RegisterExternalEncoder if available. |
| 48 // 4. Call SetEncoder with the codec settings and the object that shall receive | 48 // 4. Call SetEncoder with the codec settings and the object that shall receive |
| 49 // the encoded bit stream. | 49 // the encoded bit stream. |
| 50 // 5. For each available raw video frame call EncodeVideoFrame. | 50 // 5. For each available raw video frame call EncodeVideoFrame. |
| 51 class ViEEncoder : public VideoEncoderRateObserver, | 51 class ViEEncoder : public EncodedImageCallback, |
| 52 public EncodedImageCallback, | |
| 53 public VCMSendStatisticsCallback { | 52 public VCMSendStatisticsCallback { |
| 54 public: | 53 public: |
| 55 friend class ViEBitrateObserver; | 54 friend class ViEBitrateObserver; |
| 56 | 55 |
| 57 ViEEncoder(uint32_t number_of_cores, | 56 ViEEncoder(uint32_t number_of_cores, |
| 58 ProcessThread* module_process_thread, | 57 ProcessThread* module_process_thread, |
| 59 SendStatisticsProxy* stats_proxy, | 58 SendStatisticsProxy* stats_proxy, |
| 60 OveruseFrameDetector* overuse_detector, | 59 OveruseFrameDetector* overuse_detector, |
| 61 EncodedImageCallback* sink); | 60 EncodedImageCallback* sink); |
| 62 ~ViEEncoder(); | 61 ~ViEEncoder(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 74 void SetEncoder(const VideoCodec& video_codec, | 73 void SetEncoder(const VideoCodec& video_codec, |
| 75 size_t max_data_payload_length); | 74 size_t max_data_payload_length); |
| 76 | 75 |
| 77 void EncodeVideoFrame(const VideoFrame& video_frame); | 76 void EncodeVideoFrame(const VideoFrame& video_frame); |
| 78 void SendKeyFrame(); | 77 void SendKeyFrame(); |
| 79 | 78 |
| 80 // Returns the time when the encoder last received an input frame or produced | 79 // Returns the time when the encoder last received an input frame or produced |
| 81 // an encoded frame. | 80 // an encoded frame. |
| 82 int64_t time_of_last_frame_activity_ms(); | 81 int64_t time_of_last_frame_activity_ms(); |
| 83 | 82 |
| 84 // Implements VideoEncoderRateObserver. | |
| 85 // TODO(perkj): Refactor VideoEncoderRateObserver. This is only used for | |
| 86 // stats. The stats should be set in VideoSendStream instead. | |
| 87 // |bitrate_bps| is the target bitrate and |framerate| is the input frame | |
| 88 // rate so it has nothing to do with the actual encoder. | |
| 89 void OnSetRates(uint32_t bitrate_bps, int framerate) override; | |
| 90 | 83 |
| 91 // Implements EncodedImageCallback. | 84 // Implements EncodedImageCallback. |
| 92 int32_t Encoded(const EncodedImage& encoded_image, | 85 int32_t Encoded(const EncodedImage& encoded_image, |
| 93 const CodecSpecificInfo* codec_specific_info, | 86 const CodecSpecificInfo* codec_specific_info, |
| 94 const RTPFragmentationHeader* fragmentation) override; | 87 const RTPFragmentationHeader* fragmentation) override; |
| 95 | 88 |
| 96 // Implements VideoSendStatisticsCallback. | 89 // Implements VideoSendStatisticsCallback. |
| 97 void SendStatistics(uint32_t bit_rate, | 90 void SendStatistics(uint32_t bit_rate, |
| 98 uint32_t frame_rate, | 91 uint32_t frame_rate, |
| 99 const std::string& encoder_name) override; | 92 const std::string& encoder_name) override; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); | 130 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); |
| 138 bool has_received_rpsi_ GUARDED_BY(data_cs_); | 131 bool has_received_rpsi_ GUARDED_BY(data_cs_); |
| 139 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 132 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
| 140 | 133 |
| 141 bool video_suspended_ GUARDED_BY(data_cs_); | 134 bool video_suspended_ GUARDED_BY(data_cs_); |
| 142 }; | 135 }; |
| 143 | 136 |
| 144 } // namespace webrtc | 137 } // namespace webrtc |
| 145 | 138 |
| 146 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 139 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
| OLD | NEW |