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 29 matching lines...) Expand all Loading... |
40 class VideoEncoder; | 40 class VideoEncoder; |
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. Call Start. | 50 // 5. For each available raw video frame call EncodeVideoFrame. |
51 // 6. For each available raw video frame call EncodeVideoFrame. | |
52 class ViEEncoder : public VideoEncoderRateObserver, | 51 class ViEEncoder : public VideoEncoderRateObserver, |
53 public EncodedImageCallback, | 52 public EncodedImageCallback, |
54 public VCMSendStatisticsCallback { | 53 public VCMSendStatisticsCallback { |
55 public: | 54 public: |
56 friend class ViEBitrateObserver; | 55 friend class ViEBitrateObserver; |
57 | 56 |
58 ViEEncoder(uint32_t number_of_cores, | 57 ViEEncoder(uint32_t number_of_cores, |
59 ProcessThread* module_process_thread, | 58 ProcessThread* module_process_thread, |
60 SendStatisticsProxy* stats_proxy, | 59 SendStatisticsProxy* stats_proxy, |
61 OveruseFrameDetector* overuse_detector, | 60 OveruseFrameDetector* overuse_detector, |
62 EncodedImageCallback* sink); | 61 EncodedImageCallback* sink); |
63 ~ViEEncoder(); | 62 ~ViEEncoder(); |
64 | 63 |
65 vcm::VideoSender* video_sender(); | 64 vcm::VideoSender* video_sender(); |
66 | 65 |
67 // Returns the id of the owning channel. | 66 // Returns the id of the owning channel. |
68 int Owner() const; | 67 int Owner() const; |
69 | 68 |
70 void Start(); | |
71 // Drops incoming packets before they get to the encoder. | |
72 void Pause(); | |
73 | |
74 // Codec settings. | 69 // Codec settings. |
75 int32_t RegisterExternalEncoder(VideoEncoder* encoder, | 70 int32_t RegisterExternalEncoder(VideoEncoder* encoder, |
76 uint8_t pl_type, | 71 uint8_t pl_type, |
77 bool internal_source); | 72 bool internal_source); |
78 int32_t DeRegisterExternalEncoder(uint8_t pl_type); | 73 int32_t DeRegisterExternalEncoder(uint8_t pl_type); |
79 void SetEncoder(const VideoCodec& video_codec, | 74 void SetEncoder(const VideoCodec& video_codec, |
80 size_t max_data_payload_length); | 75 size_t max_data_payload_length); |
81 | 76 |
82 void EncodeVideoFrame(const VideoFrame& video_frame); | 77 void EncodeVideoFrame(const VideoFrame& video_frame); |
83 void SendKeyFrame(); | 78 void SendKeyFrame(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 122 |
128 SendStatisticsProxy* const stats_proxy_; | 123 SendStatisticsProxy* const stats_proxy_; |
129 OveruseFrameDetector* const overuse_detector_; | 124 OveruseFrameDetector* const overuse_detector_; |
130 | 125 |
131 // The time we last received an input frame or encoded frame. This is used to | 126 // The time we last received an input frame or encoded frame. This is used to |
132 // track when video is stopped long enough that we also want to stop sending | 127 // track when video is stopped long enough that we also want to stop sending |
133 // padding. | 128 // padding. |
134 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); | 129 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); |
135 VideoCodec encoder_config_ GUARDED_BY(data_cs_); | 130 VideoCodec encoder_config_ GUARDED_BY(data_cs_); |
136 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); | 131 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); |
137 bool encoder_paused_ GUARDED_BY(data_cs_); | |
138 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); | 132 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); |
139 | 133 |
140 ProcessThread* module_process_thread_; | 134 ProcessThread* module_process_thread_; |
141 | 135 |
142 bool has_received_sli_ GUARDED_BY(data_cs_); | 136 bool has_received_sli_ GUARDED_BY(data_cs_); |
143 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); | 137 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); |
144 bool has_received_rpsi_ GUARDED_BY(data_cs_); | 138 bool has_received_rpsi_ GUARDED_BY(data_cs_); |
145 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 139 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
146 | 140 |
147 bool video_suspended_ GUARDED_BY(data_cs_); | 141 bool video_suspended_ GUARDED_BY(data_cs_); |
148 }; | 142 }; |
149 | 143 |
150 } // namespace webrtc | 144 } // namespace webrtc |
151 | 145 |
152 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 146 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |