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 <string> |
15 #include <vector> | 16 #include <vector> |
16 | 17 |
17 #include "webrtc/base/criticalsection.h" | 18 #include "webrtc/base/criticalsection.h" |
18 #include "webrtc/base/scoped_ref_ptr.h" | 19 #include "webrtc/base/scoped_ref_ptr.h" |
19 #include "webrtc/base/thread_annotations.h" | 20 #include "webrtc/base/thread_annotations.h" |
20 #include "webrtc/common_types.h" | 21 #include "webrtc/common_types.h" |
21 #include "webrtc/video_encoder.h" | 22 #include "webrtc/video_encoder.h" |
22 #include "webrtc/media/base/videosinkinterface.h" | 23 #include "webrtc/media/base/videosinkinterface.h" |
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
24 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 25 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
(...skipping 12 matching lines...) Expand all Loading... |
37 class ProcessThread; | 38 class ProcessThread; |
38 class QMVideoSettingsCallback; | 39 class QMVideoSettingsCallback; |
39 class SendStatisticsProxy; | 40 class SendStatisticsProxy; |
40 class ViEBitrateObserver; | 41 class ViEBitrateObserver; |
41 class ViEEffectFilter; | 42 class ViEEffectFilter; |
42 class VideoCodingModule; | 43 class VideoCodingModule; |
43 class VideoEncoder; | 44 class VideoEncoder; |
44 | 45 |
45 class ViEEncoder : public VideoEncoderRateObserver, | 46 class ViEEncoder : public VideoEncoderRateObserver, |
46 public EncodedImageCallback, | 47 public EncodedImageCallback, |
47 public VCMPacketizationCallback, | |
48 public VCMSendStatisticsCallback { | 48 public VCMSendStatisticsCallback { |
49 public: | 49 public: |
50 friend class ViEBitrateObserver; | 50 friend class ViEBitrateObserver; |
51 | 51 |
52 ViEEncoder(uint32_t number_of_cores, | 52 ViEEncoder(uint32_t number_of_cores, |
53 const std::vector<uint32_t>& ssrcs, | 53 const std::vector<uint32_t>& ssrcs, |
54 ProcessThread* module_process_thread, | 54 ProcessThread* module_process_thread, |
55 SendStatisticsProxy* stats_proxy, | 55 SendStatisticsProxy* stats_proxy, |
56 // TODO(nisse): Used only for tests, delete? | 56 // TODO(nisse): Used only for tests, delete? |
57 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, | 57 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, |
58 OveruseFrameDetector* overuse_detector, | 58 OveruseFrameDetector* overuse_detector, |
59 PacedSender* pacer, | 59 PacedSender* pacer, |
60 PayloadRouter* payload_router, | 60 PayloadRouter* payload_router, |
61 EncodedImageCallback* post_encode_callback); | 61 EncodedImageCallback* post_encode_callback); |
62 ~ViEEncoder(); | 62 ~ViEEncoder(); |
63 | 63 |
64 bool Init(); | |
65 | |
66 vcm::VideoSender* video_sender(); | 64 vcm::VideoSender* video_sender(); |
67 | 65 |
68 void SetNetworkTransmissionState(bool is_transmitting); | 66 void SetNetworkTransmissionState(bool is_transmitting); |
69 | 67 |
70 // Returns the id of the owning channel. | 68 // Returns the id of the owning channel. |
71 int Owner() const; | 69 int Owner() const; |
72 | 70 |
73 // Drops incoming packets before they get to the encoder. | 71 // Drops incoming packets before they get to the encoder. |
74 void Pause(); | 72 void Pause(); |
75 void Restart(); | 73 void Restart(); |
(...skipping 10 matching lines...) Expand all Loading... |
86 | 84 |
87 uint32_t LastObservedBitrateBps() const; | 85 uint32_t LastObservedBitrateBps() const; |
88 // Loss protection. Must be called before SetEncoder() to have max packet size | 86 // Loss protection. Must be called before SetEncoder() to have max packet size |
89 // updated according to protection. | 87 // updated according to protection. |
90 // TODO(pbos): Set protection method on construction. | 88 // TODO(pbos): Set protection method on construction. |
91 void SetProtectionMethod(bool nack, bool fec); | 89 void SetProtectionMethod(bool nack, bool fec); |
92 | 90 |
93 // Implements VideoEncoderRateObserver. | 91 // Implements VideoEncoderRateObserver. |
94 void OnSetRates(uint32_t bitrate_bps, int framerate) override; | 92 void OnSetRates(uint32_t bitrate_bps, int framerate) override; |
95 | 93 |
96 // Implements VCMPacketizationCallback. | |
97 void OnEncoderImplementationName(const char* implementation_name) override; | |
98 | |
99 // Implements EncodedImageCallback. | 94 // Implements EncodedImageCallback. |
100 int32_t Encoded(const EncodedImage& encoded_image, | 95 int32_t Encoded(const EncodedImage& encoded_image, |
101 const CodecSpecificInfo* codec_specific_info, | 96 const CodecSpecificInfo* codec_specific_info, |
102 const RTPFragmentationHeader* fragmentation) override; | 97 const RTPFragmentationHeader* fragmentation) override; |
103 | 98 |
104 // Implements VideoSendStatisticsCallback. | 99 // Implements VideoSendStatisticsCallback. |
105 int32_t SendStatistics(const uint32_t bit_rate, | 100 int32_t SendStatistics(const uint32_t bit_rate, |
106 const uint32_t frame_rate) override; | 101 const uint32_t frame_rate, |
| 102 std::string&& encoder_name) override; |
107 | 103 |
108 // virtual to test EncoderStateFeedback with mocks. | 104 // virtual to test EncoderStateFeedback with mocks. |
109 virtual void OnReceivedIntraFrameRequest(uint32_t ssrc); | 105 virtual void OnReceivedIntraFrameRequest(uint32_t ssrc); |
110 virtual void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id); | 106 virtual void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id); |
111 virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id); | 107 virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id); |
112 | 108 |
113 int GetPaddingNeededBps() const; | 109 int GetPaddingNeededBps() const; |
114 | 110 |
115 void OnBitrateUpdated(uint32_t bitrate_bps, | 111 void OnBitrateUpdated(uint32_t bitrate_bps, |
116 uint8_t fraction_lost, | 112 uint8_t fraction_lost, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 156 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
161 | 157 |
162 bool video_suspended_ GUARDED_BY(data_cs_); | 158 bool video_suspended_ GUARDED_BY(data_cs_); |
163 | 159 |
164 std::unique_ptr<IvfFileWriter> file_writers_[kMaxLayers] GUARDED_BY(data_cs_); | 160 std::unique_ptr<IvfFileWriter> file_writers_[kMaxLayers] GUARDED_BY(data_cs_); |
165 }; | 161 }; |
166 | 162 |
167 } // namespace webrtc | 163 } // namespace webrtc |
168 | 164 |
169 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 165 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |