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 |
11 #ifndef WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ | 11 #ifndef WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ |
12 #define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ | 12 #define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/call/bitrate_allocator.h" | 17 #include "webrtc/call/bitrate_allocator.h" |
| 18 #include "webrtc/base/criticalsection.h" |
18 #include "webrtc/call.h" | 19 #include "webrtc/call.h" |
19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
20 #include "webrtc/video/encoded_frame_callback_adapter.h" | 21 #include "webrtc/video/encoded_frame_callback_adapter.h" |
21 #include "webrtc/video/encoder_state_feedback.h" | 22 #include "webrtc/video/encoder_state_feedback.h" |
22 #include "webrtc/video/payload_router.h" | 23 #include "webrtc/video/payload_router.h" |
23 #include "webrtc/video/send_statistics_proxy.h" | 24 #include "webrtc/video/send_statistics_proxy.h" |
24 #include "webrtc/video/video_capture_input.h" | 25 #include "webrtc/video/video_capture_input.h" |
25 #include "webrtc/video/vie_channel.h" | 26 #include "webrtc/video/vie_channel.h" |
26 #include "webrtc/video/vie_encoder.h" | 27 #include "webrtc/video/vie_encoder.h" |
27 #include "webrtc/video_receive_stream.h" | 28 #include "webrtc/video_receive_stream.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 RtpStateMap GetRtpStates() const; | 76 RtpStateMap GetRtpStates() const; |
76 | 77 |
77 int GetPaddingNeededBps() const; | 78 int GetPaddingNeededBps() const; |
78 | 79 |
79 // Implements BitrateAllocatorObserver. | 80 // Implements BitrateAllocatorObserver. |
80 void OnBitrateUpdated(uint32_t bitrate_bps, | 81 void OnBitrateUpdated(uint32_t bitrate_bps, |
81 uint8_t fraction_loss, | 82 uint8_t fraction_loss, |
82 int64_t rtt) override; | 83 int64_t rtt) override; |
83 | 84 |
84 private: | 85 private: |
| 86 struct EncoderSettings { |
| 87 VideoCodec video_codec; |
| 88 int min_transmit_bitrate_bps; |
| 89 }; |
85 static bool EncoderThreadFunction(void* obj); | 90 static bool EncoderThreadFunction(void* obj); |
86 void EncoderProcess(); | 91 void EncoderProcess(); |
87 | 92 |
88 void ConfigureSsrcs(); | 93 void ConfigureSsrcs(); |
89 | 94 |
90 SendStatisticsProxy stats_proxy_; | 95 SendStatisticsProxy stats_proxy_; |
91 EncodedFrameCallbackAdapter encoded_frame_proxy_; | 96 EncodedFrameCallbackAdapter encoded_frame_proxy_; |
92 const VideoSendStream::Config config_; | 97 const VideoSendStream::Config config_; |
93 std::map<uint32_t, RtpState> suspended_ssrcs_; | 98 std::map<uint32_t, RtpState> suspended_ssrcs_; |
94 | 99 |
95 ProcessThread* const module_process_thread_; | 100 ProcessThread* const module_process_thread_; |
96 CallStats* const call_stats_; | 101 CallStats* const call_stats_; |
97 CongestionController* const congestion_controller_; | 102 CongestionController* const congestion_controller_; |
98 BitrateAllocator* const bitrate_allocator_; | 103 BitrateAllocator* const bitrate_allocator_; |
99 VieRemb* const remb_; | 104 VieRemb* const remb_; |
100 | 105 |
101 rtc::PlatformThread encoder_thread_; | 106 rtc::PlatformThread encoder_thread_; |
102 rtc::Event encoder_wakeup_event_; | 107 rtc::Event encoder_wakeup_event_; |
103 volatile int stop_encoder_thread_; | 108 volatile int stop_encoder_thread_; |
| 109 rtc::CriticalSection encoder_settings_crit_; |
| 110 rtc::Optional<EncoderSettings> pending_encoder_settings_ |
| 111 GUARDED_BY(encoder_settings_crit_); |
104 | 112 |
105 OveruseFrameDetector overuse_detector_; | 113 OveruseFrameDetector overuse_detector_; |
106 PayloadRouter payload_router_; | 114 PayloadRouter payload_router_; |
107 EncoderStateFeedback encoder_feedback_; | 115 EncoderStateFeedback encoder_feedback_; |
108 ViEChannel vie_channel_; | 116 ViEChannel vie_channel_; |
109 ViEReceiver* const vie_receiver_; | 117 ViEReceiver* const vie_receiver_; |
110 ViEEncoder vie_encoder_; | 118 ViEEncoder vie_encoder_; |
111 VideoCodingModule* const vcm_; | 119 VideoCodingModule* const vcm_; |
112 // TODO(pbos): Move RtpRtcp ownership to VideoSendStream. | 120 // TODO(pbos): Move RtpRtcp ownership to VideoSendStream. |
113 // RtpRtcp modules, currently owned by ViEChannel but ownership should | 121 // RtpRtcp modules, currently owned by ViEChannel but ownership should |
114 // eventually move here. | 122 // eventually move here. |
115 const std::vector<RtpRtcp*> rtp_rtcp_modules_; | 123 const std::vector<RtpRtcp*> rtp_rtcp_modules_; |
116 VideoCaptureInput input_; | 124 VideoCaptureInput input_; |
117 }; | 125 }; |
118 } // namespace internal | 126 } // namespace internal |
119 } // namespace webrtc | 127 } // namespace webrtc |
120 | 128 |
121 #endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ | 129 #endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ |
OLD | NEW |