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