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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 VideoEncoderRateObserver, |
52 public EncodedImageCallback, | 52 public EncodedImageCallback, |
53 public VCMSendStatisticsCallback { | 53 public VCMSendStatisticsCallback { |
54 public: | 54 public: |
55 friend class ViEBitrateObserver; | 55 friend class ViEBitrateObserver; |
56 | 56 |
57 ViEEncoder(uint32_t number_of_cores, | 57 ViEEncoder(uint32_t number_of_cores, |
58 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(); |
| 62 // RegisterProcessThread register |module_process_thread| with those objects |
| 63 // that use it. Registration have to happen on the thread where |
| 64 // |module_process_thread| where created (libjingles worker thread). |
| 65 // TODO(perkj): Replace the use of |module_process_thread| with a TaskQueue. |
| 66 void RegisterProcessThread(ProcessThread* module_process_thread); |
| 67 void DeRegisterProcessThread(); |
63 | 68 |
64 vcm::VideoSender* video_sender(); | 69 vcm::VideoSender* video_sender(); |
65 | 70 |
66 // Returns the id of the owning channel. | 71 // Returns the id of the owning channel. |
67 int Owner() const; | 72 int Owner() const; |
68 | 73 |
69 // Codec settings. | 74 // Codec settings. |
70 int32_t RegisterExternalEncoder(VideoEncoder* encoder, | 75 int32_t RegisterExternalEncoder(VideoEncoder* encoder, |
71 uint8_t pl_type, | 76 uint8_t pl_type, |
72 bool internal_source); | 77 bool internal_source); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 EncodedImageCallback* const sink_; | 121 EncodedImageCallback* const sink_; |
117 | 122 |
118 const std::unique_ptr<VideoProcessing> vp_; | 123 const std::unique_ptr<VideoProcessing> vp_; |
119 vcm::VideoSender video_sender_; | 124 vcm::VideoSender video_sender_; |
120 | 125 |
121 rtc::CriticalSection data_cs_; | 126 rtc::CriticalSection data_cs_; |
122 | 127 |
123 SendStatisticsProxy* const stats_proxy_; | 128 SendStatisticsProxy* const stats_proxy_; |
124 OveruseFrameDetector* const overuse_detector_; | 129 OveruseFrameDetector* const overuse_detector_; |
125 | 130 |
126 // The time we last received an input frame or encoded frame. This is used to | |
127 // track when video is stopped long enough that we also want to stop sending | |
128 // padding. | |
129 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); | |
130 VideoCodec encoder_config_ GUARDED_BY(data_cs_); | 131 VideoCodec encoder_config_ GUARDED_BY(data_cs_); |
131 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); | 132 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); |
132 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); | 133 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); |
133 | 134 |
134 ProcessThread* module_process_thread_; | 135 ProcessThread* module_process_thread_; |
135 | 136 |
136 bool has_received_sli_ GUARDED_BY(data_cs_); | 137 bool has_received_sli_ GUARDED_BY(data_cs_); |
137 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); | 138 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); |
138 bool has_received_rpsi_ GUARDED_BY(data_cs_); | 139 bool has_received_rpsi_ GUARDED_BY(data_cs_); |
139 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 140 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
140 | 141 |
141 bool video_suspended_ GUARDED_BY(data_cs_); | 142 bool video_suspended_ GUARDED_BY(data_cs_); |
142 }; | 143 }; |
143 | 144 |
144 } // namespace webrtc | 145 } // namespace webrtc |
145 | 146 |
146 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 147 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |