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 |
11 #ifndef WEBRTC_VIDEO_VIE_ENCODER_H_ | 11 #ifndef WEBRTC_VIDEO_VIE_ENCODER_H_ |
12 #define WEBRTC_VIDEO_VIE_ENCODER_H_ | 12 #define WEBRTC_VIDEO_VIE_ENCODER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/criticalsection.h" | 17 #include "webrtc/base/criticalsection.h" |
18 #include "webrtc/base/scoped_ref_ptr.h" | 18 #include "webrtc/base/scoped_ref_ptr.h" |
19 #include "webrtc/base/thread_annotations.h" | 19 #include "webrtc/base/thread_annotations.h" |
20 #include "webrtc/call/bitrate_allocator.h" | 20 #include "webrtc/call/bitrate_allocator.h" |
21 #include "webrtc/common_types.h" | 21 #include "webrtc/common_types.h" |
22 #include "webrtc/frame_callback.h" | 22 #include "webrtc/frame_callback.h" |
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
24 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 24 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
25 #include "webrtc/modules/video_processing/include/video_processing.h" | 25 #include "webrtc/modules/video_processing/include/video_processing.h" |
26 #include "webrtc/typedefs.h" | 26 #include "webrtc/typedefs.h" |
27 #include "webrtc/video/video_capture_input.h" | |
28 | 27 |
29 namespace webrtc { | 28 namespace webrtc { |
30 | 29 |
31 class BitrateAllocator; | 30 class BitrateAllocator; |
32 class BitrateObserver; | 31 class BitrateObserver; |
33 class Config; | 32 class Config; |
34 class EncodedImageCallback; | 33 class EncodedImageCallback; |
35 class OveruseFrameDetector; | 34 class OveruseFrameDetector; |
36 class PacedSender; | 35 class PacedSender; |
37 class PayloadRouter; | 36 class PayloadRouter; |
38 class ProcessThread; | 37 class ProcessThread; |
39 class QMVideoSettingsCallback; | 38 class QMVideoSettingsCallback; |
40 class SendStatisticsProxy; | 39 class SendStatisticsProxy; |
41 class ViEBitrateObserver; | 40 class ViEBitrateObserver; |
42 class ViEEffectFilter; | 41 class ViEEffectFilter; |
43 class VideoCodingModule; | 42 class VideoCodingModule; |
| 43 class VideoEncoder; |
44 | 44 |
45 class ViEEncoder : public VideoEncoderRateObserver, | 45 class ViEEncoder : public VideoEncoderRateObserver, |
46 public VCMPacketizationCallback, | 46 public VCMPacketizationCallback, |
47 public VCMSendStatisticsCallback, | 47 public VCMSendStatisticsCallback { |
48 public VideoCaptureCallback { | |
49 public: | 48 public: |
50 friend class ViEBitrateObserver; | 49 friend class ViEBitrateObserver; |
51 | 50 |
52 ViEEncoder(uint32_t number_of_cores, | 51 ViEEncoder(uint32_t number_of_cores, |
53 const std::vector<uint32_t>& ssrcs, | 52 const std::vector<uint32_t>& ssrcs, |
54 ProcessThread* module_process_thread, | 53 ProcessThread* module_process_thread, |
55 SendStatisticsProxy* stats_proxy, | 54 SendStatisticsProxy* stats_proxy, |
56 I420FrameCallback* pre_encode_callback, | 55 I420FrameCallback* pre_encode_callback, |
57 OveruseFrameDetector* overuse_detector, | 56 OveruseFrameDetector* overuse_detector, |
58 PacedSender* pacer, | 57 PacedSender* pacer, |
(...skipping 14 matching lines...) Expand all Loading... |
73 void Pause(); | 72 void Pause(); |
74 void Restart(); | 73 void Restart(); |
75 | 74 |
76 // Codec settings. | 75 // Codec settings. |
77 int32_t RegisterExternalEncoder(VideoEncoder* encoder, | 76 int32_t RegisterExternalEncoder(VideoEncoder* encoder, |
78 uint8_t pl_type, | 77 uint8_t pl_type, |
79 bool internal_source); | 78 bool internal_source); |
80 int32_t DeRegisterExternalEncoder(uint8_t pl_type); | 79 int32_t DeRegisterExternalEncoder(uint8_t pl_type); |
81 void SetEncoder(const VideoCodec& video_codec, int min_transmit_bitrate_bps); | 80 void SetEncoder(const VideoCodec& video_codec, int min_transmit_bitrate_bps); |
82 | 81 |
83 // Implementing VideoCaptureCallback. | 82 void EncodeVideoFrame(const VideoFrame& video_frame); |
84 void DeliverFrame(VideoFrame video_frame) override; | |
85 | |
86 void SendKeyFrame(); | 83 void SendKeyFrame(); |
87 | 84 |
88 uint32_t LastObservedBitrateBps() const; | 85 uint32_t LastObservedBitrateBps() const; |
89 int CodecTargetBitrate(uint32_t* bitrate) const; | 86 int CodecTargetBitrate(uint32_t* bitrate) const; |
90 // Loss protection. Must be called before SetEncoder() to have max packet size | 87 // Loss protection. Must be called before SetEncoder() to have max packet size |
91 // updated according to protection. | 88 // updated according to protection. |
92 // TODO(pbos): Set protection method on construction or extract vcm_ outside | 89 // TODO(pbos): Set protection method on construction or extract vcm_ outside |
93 // this class and set it on construction there. | 90 // this class and set it on construction there. |
94 void SetProtectionMethod(bool nack, bool fec); | 91 void SetProtectionMethod(bool nack, bool fec); |
95 | 92 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); | 166 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); |
170 bool has_received_rpsi_ GUARDED_BY(data_cs_); | 167 bool has_received_rpsi_ GUARDED_BY(data_cs_); |
171 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 168 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
172 | 169 |
173 bool video_suspended_ GUARDED_BY(data_cs_); | 170 bool video_suspended_ GUARDED_BY(data_cs_); |
174 }; | 171 }; |
175 | 172 |
176 } // namespace webrtc | 173 } // namespace webrtc |
177 | 174 |
178 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 175 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |