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 11 matching lines...) Expand all Loading... |
36 class ProcessThread; | 37 class ProcessThread; |
37 class QMVideoSettingsCallback; | 38 class QMVideoSettingsCallback; |
38 class SendStatisticsProxy; | 39 class SendStatisticsProxy; |
39 class ViEBitrateObserver; | 40 class ViEBitrateObserver; |
40 class ViEEffectFilter; | 41 class ViEEffectFilter; |
41 class VideoCodingModule; | 42 class VideoCodingModule; |
42 class VideoEncoder; | 43 class VideoEncoder; |
43 | 44 |
44 class ViEEncoder : public VideoEncoderRateObserver, | 45 class ViEEncoder : public VideoEncoderRateObserver, |
45 public EncodedImageCallback, | 46 public EncodedImageCallback, |
46 public VCMPacketizationCallback, | |
47 public VCMSendStatisticsCallback { | 47 public VCMSendStatisticsCallback { |
48 public: | 48 public: |
49 friend class ViEBitrateObserver; | 49 friend class ViEBitrateObserver; |
50 | 50 |
51 ViEEncoder(uint32_t number_of_cores, | 51 ViEEncoder(uint32_t number_of_cores, |
52 const std::vector<uint32_t>& ssrcs, | 52 const std::vector<uint32_t>& ssrcs, |
53 ProcessThread* module_process_thread, | 53 ProcessThread* module_process_thread, |
54 SendStatisticsProxy* stats_proxy, | 54 SendStatisticsProxy* stats_proxy, |
55 // TODO(nisse): Used only for tests, delete? | 55 // TODO(nisse): Used only for tests, delete? |
56 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, | 56 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, |
(...skipping 30 matching lines...) Expand all Loading... |
87 int CodecTargetBitrate(uint32_t* bitrate) const; | 87 int CodecTargetBitrate(uint32_t* bitrate) const; |
88 // Loss protection. Must be called before SetEncoder() to have max packet size | 88 // Loss protection. Must be called before SetEncoder() to have max packet size |
89 // updated according to protection. | 89 // updated according to protection. |
90 // TODO(pbos): Set protection method on construction or extract vcm_ outside | 90 // TODO(pbos): Set protection method on construction or extract vcm_ outside |
91 // this class and set it on construction there. | 91 // this class and set it on construction there. |
92 void SetProtectionMethod(bool nack, bool fec); | 92 void SetProtectionMethod(bool nack, bool fec); |
93 | 93 |
94 // Implements VideoEncoderRateObserver. | 94 // Implements VideoEncoderRateObserver. |
95 void OnSetRates(uint32_t bitrate_bps, int framerate) override; | 95 void OnSetRates(uint32_t bitrate_bps, int framerate) override; |
96 | 96 |
97 // Implements VCMPacketizationCallback. | |
98 void OnEncoderImplementationName(const char* implementation_name) override; | |
99 | |
100 // Implements EncodedImageCallback. | 97 // Implements EncodedImageCallback. |
101 int32_t Encoded(const EncodedImage& encoded_image, | 98 int32_t Encoded(const EncodedImage& encoded_image, |
102 const CodecSpecificInfo* codec_specific_info, | 99 const CodecSpecificInfo* codec_specific_info, |
103 const RTPFragmentationHeader* fragmentation) override; | 100 const RTPFragmentationHeader* fragmentation) override; |
104 | 101 |
105 // Implements VideoSendStatisticsCallback. | 102 // Implements VideoSendStatisticsCallback. |
106 int32_t SendStatistics(const uint32_t bit_rate, | 103 int32_t SendStatistics(const uint32_t bit_rate, |
107 const uint32_t frame_rate) override; | 104 const uint32_t frame_rate, |
| 105 std::string&& encoder_name) override; |
108 | 106 |
109 // virtual to test EncoderStateFeedback with mocks. | 107 // virtual to test EncoderStateFeedback with mocks. |
110 virtual void OnReceivedIntraFrameRequest(uint32_t ssrc); | 108 virtual void OnReceivedIntraFrameRequest(uint32_t ssrc); |
111 virtual void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id); | 109 virtual void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id); |
112 virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id); | 110 virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id); |
113 | 111 |
114 int GetPaddingNeededBps() const; | 112 int GetPaddingNeededBps() const; |
115 | 113 |
116 void OnBitrateUpdated(uint32_t bitrate_bps, | 114 void OnBitrateUpdated(uint32_t bitrate_bps, |
117 uint8_t fraction_lost, | 115 uint8_t fraction_lost, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 159 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
162 | 160 |
163 bool video_suspended_ GUARDED_BY(data_cs_); | 161 bool video_suspended_ GUARDED_BY(data_cs_); |
164 | 162 |
165 std::unique_ptr<IvfFileWriter> file_writers_[kMaxLayers] GUARDED_BY(data_cs_); | 163 std::unique_ptr<IvfFileWriter> file_writers_[kMaxLayers] GUARDED_BY(data_cs_); |
166 }; | 164 }; |
167 | 165 |
168 } // namespace webrtc | 166 } // namespace webrtc |
169 | 167 |
170 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 168 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |