OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 namespace vcm { | 45 namespace vcm { |
46 class VideoSender; | 46 class VideoSender; |
47 } // namespace vcm | 47 } // namespace vcm |
48 | 48 |
49 namespace internal { | 49 namespace internal { |
50 | 50 |
51 class VideoSendStream : public webrtc::VideoSendStream, | 51 class VideoSendStream : public webrtc::VideoSendStream, |
52 public webrtc::CpuOveruseObserver, | 52 public webrtc::CpuOveruseObserver, |
53 public webrtc::BitrateAllocatorObserver, | 53 public webrtc::BitrateAllocatorObserver, |
54 public webrtc::VCMProtectionCallback, | 54 public webrtc::VCMProtectionCallback, |
55 protected webrtc::EncodedImageCallback { | 55 public EncodedImageCallback { |
56 public: | 56 public: |
57 VideoSendStream(int num_cpu_cores, | 57 VideoSendStream(int num_cpu_cores, |
58 ProcessThread* module_process_thread, | 58 ProcessThread* module_process_thread, |
59 CallStats* call_stats, | 59 CallStats* call_stats, |
60 CongestionController* congestion_controller, | 60 CongestionController* congestion_controller, |
61 BitrateAllocator* bitrate_allocator, | 61 BitrateAllocator* bitrate_allocator, |
62 SendDelayStats* send_delay_stats, | 62 SendDelayStats* send_delay_stats, |
63 VieRemb* remb, | 63 VieRemb* remb, |
64 RtcEventLog* event_log, | 64 RtcEventLog* event_log, |
65 const VideoSendStream::Config& config, | 65 const VideoSendStream::Config& config, |
(...skipping 30 matching lines...) Expand all Loading... |
96 // Implements webrtc::VCMProtectionCallback. | 96 // Implements webrtc::VCMProtectionCallback. |
97 int ProtectionRequest(const FecProtectionParams* delta_params, | 97 int ProtectionRequest(const FecProtectionParams* delta_params, |
98 const FecProtectionParams* key_params, | 98 const FecProtectionParams* key_params, |
99 uint32_t* sent_video_rate_bps, | 99 uint32_t* sent_video_rate_bps, |
100 uint32_t* sent_nack_rate_bps, | 100 uint32_t* sent_nack_rate_bps, |
101 uint32_t* sent_fec_rate_bps) override; | 101 uint32_t* sent_fec_rate_bps) override; |
102 | 102 |
103 private: | 103 private: |
104 struct EncoderSettings { | 104 struct EncoderSettings { |
105 VideoCodec video_codec; | 105 VideoCodec video_codec; |
106 int min_transmit_bitrate_bps; | 106 VideoEncoderConfig config; |
107 std::vector<VideoStream> streams; | |
108 }; | 107 }; |
109 | 108 |
110 // Implements EncodedImageCallback. The implementation routes encoded frames | 109 // Implements EncodedImageCallback. The implementation routes encoded frames |
111 // to the |payload_router_| and |config.pre_encode_callback| if set. | 110 // to the |payload_router_| and |config.pre_encode_callback| if set. |
112 // Called on an arbitrary encoder callback thread. | 111 // Called on an arbitrary encoder callback thread. |
113 int32_t Encoded(const EncodedImage& encoded_image, | 112 int32_t Encoded(const EncodedImage& encoded_image, |
114 const CodecSpecificInfo* codec_specific_info, | 113 const CodecSpecificInfo* codec_specific_info, |
115 const RTPFragmentationHeader* fragmentation) override; | 114 const RTPFragmentationHeader* fragmentation) override; |
116 | 115 |
117 static bool EncoderThreadFunction(void* obj); | 116 static bool EncoderThreadFunction(void* obj); |
(...skipping 14 matching lines...) Expand all Loading... |
132 VieRemb* const remb_; | 131 VieRemb* const remb_; |
133 | 132 |
134 static const bool kEnableFrameRecording = false; | 133 static const bool kEnableFrameRecording = false; |
135 static const int kMaxLayers = 3; | 134 static const int kMaxLayers = 3; |
136 std::unique_ptr<IvfFileWriter> file_writers_[kMaxLayers]; | 135 std::unique_ptr<IvfFileWriter> file_writers_[kMaxLayers]; |
137 | 136 |
138 rtc::PlatformThread encoder_thread_; | 137 rtc::PlatformThread encoder_thread_; |
139 rtc::Event encoder_wakeup_event_; | 138 rtc::Event encoder_wakeup_event_; |
140 volatile int stop_encoder_thread_; | 139 volatile int stop_encoder_thread_; |
141 rtc::CriticalSection encoder_settings_crit_; | 140 rtc::CriticalSection encoder_settings_crit_; |
142 rtc::Optional<EncoderSettings> pending_encoder_settings_ | 141 std::unique_ptr<EncoderSettings> pending_encoder_settings_ |
143 GUARDED_BY(encoder_settings_crit_); | 142 GUARDED_BY(encoder_settings_crit_); |
| 143 // Only used on the encoder thread. |
| 144 bool send_stream_registered_as_observer_; |
| 145 std::unique_ptr<EncoderSettings> current_encoder_settings_; |
144 | 146 |
145 OveruseFrameDetector overuse_detector_; | 147 OveruseFrameDetector overuse_detector_; |
146 ViEEncoder vie_encoder_; | 148 ViEEncoder vie_encoder_; |
147 EncoderStateFeedback encoder_feedback_; | 149 EncoderStateFeedback encoder_feedback_; |
148 ProtectionBitrateCalculator protection_bitrate_calculator_; | 150 ProtectionBitrateCalculator protection_bitrate_calculator_; |
149 | 151 |
150 vcm::VideoSender* const video_sender_; | 152 vcm::VideoSender* const video_sender_; |
151 | 153 |
152 const std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_; | 154 const std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_; |
153 // RtpRtcp modules, declared here as they use other members on construction. | 155 // RtpRtcp modules, declared here as they use other members on construction. |
154 const std::vector<RtpRtcp*> rtp_rtcp_modules_; | 156 const std::vector<RtpRtcp*> rtp_rtcp_modules_; |
155 PayloadRouter payload_router_; | 157 PayloadRouter payload_router_; |
156 VideoCaptureInput input_; | 158 VideoCaptureInput input_; |
157 }; | 159 }; |
158 } // namespace internal | 160 } // namespace internal |
159 } // namespace webrtc | 161 } // namespace webrtc |
160 | 162 |
161 #endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ | 163 #endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ |
OLD | NEW |