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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // the encoded bit stream. | 49 // the encoded bit stream. |
50 // 5. Call Start. | 50 // 5. Call Start. |
51 // 6. For each available raw video frame call EncodeVideoFrame. | 51 // 6. For each available raw video frame call EncodeVideoFrame. |
52 class ViEEncoder : public VideoEncoderRateObserver, | 52 class ViEEncoder : public VideoEncoderRateObserver, |
53 public EncodedImageCallback, | 53 public EncodedImageCallback, |
54 public VCMSendStatisticsCallback { | 54 public VCMSendStatisticsCallback { |
55 public: | 55 public: |
56 friend class ViEBitrateObserver; | 56 friend class ViEBitrateObserver; |
57 | 57 |
58 ViEEncoder(uint32_t number_of_cores, | 58 ViEEncoder(uint32_t number_of_cores, |
59 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(); |
| 63 // RegisterProcessThread register |module_process_thread| with those objects |
| 64 // that use it. Registration have to happen on the thread where |
| 65 // |module_process_thread| where created (libjingles worker thread). |
| 66 // TODO(perkj): Replace the use of |module_process_thread| with a TaskQueue. |
| 67 void RegisterProcessThread(ProcessThread* module_process_thread); |
| 68 void DeRegisterProcessThread(); |
64 | 69 |
65 vcm::VideoSender* video_sender(); | 70 vcm::VideoSender* video_sender(); |
66 | 71 |
67 // Returns the id of the owning channel. | 72 // Returns the id of the owning channel. |
68 int Owner() const; | 73 int Owner() const; |
69 | 74 |
70 void Start(); | 75 void Start(); |
71 // Drops incoming packets before they get to the encoder. | 76 // Drops incoming packets before they get to the encoder. |
72 void Pause(); | 77 void Pause(); |
73 | 78 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 EncodedImageCallback* const sink_; | 126 EncodedImageCallback* const sink_; |
122 | 127 |
123 const std::unique_ptr<VideoProcessing> vp_; | 128 const std::unique_ptr<VideoProcessing> vp_; |
124 vcm::VideoSender video_sender_; | 129 vcm::VideoSender video_sender_; |
125 | 130 |
126 rtc::CriticalSection data_cs_; | 131 rtc::CriticalSection data_cs_; |
127 | 132 |
128 SendStatisticsProxy* const stats_proxy_; | 133 SendStatisticsProxy* const stats_proxy_; |
129 OveruseFrameDetector* const overuse_detector_; | 134 OveruseFrameDetector* const overuse_detector_; |
130 | 135 |
131 // 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 | |
133 // padding. | |
134 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); | |
135 VideoCodec encoder_config_ GUARDED_BY(data_cs_); | 136 VideoCodec encoder_config_ GUARDED_BY(data_cs_); |
136 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); | 137 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); |
137 bool encoder_paused_ GUARDED_BY(data_cs_); | 138 bool encoder_paused_ GUARDED_BY(data_cs_); |
138 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); | 139 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); |
139 | 140 |
140 ProcessThread* module_process_thread_; | 141 ProcessThread* module_process_thread_; |
141 | 142 |
142 bool has_received_sli_ GUARDED_BY(data_cs_); | 143 bool has_received_sli_ GUARDED_BY(data_cs_); |
143 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); | 144 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); |
144 bool has_received_rpsi_ GUARDED_BY(data_cs_); | 145 bool has_received_rpsi_ GUARDED_BY(data_cs_); |
145 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 146 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
146 | 147 |
147 bool video_suspended_ GUARDED_BY(data_cs_); | 148 bool video_suspended_ GUARDED_BY(data_cs_); |
148 }; | 149 }; |
149 | 150 |
150 } // namespace webrtc | 151 } // namespace webrtc |
151 | 152 |
152 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 153 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |