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