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_CHANNEL_H_ | 11 #ifndef WEBRTC_VIDEO_VIE_CHANNEL_H_ |
12 #define WEBRTC_VIDEO_VIE_CHANNEL_H_ | 12 #define WEBRTC_VIDEO_VIE_CHANNEL_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <map> | 15 #include <map> |
16 #include <memory> | 16 #include <memory> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/base/criticalsection.h" | 19 #include "webrtc/base/criticalsection.h" |
20 #include "webrtc/base/platform_thread.h" | 20 #include "webrtc/base/platform_thread.h" |
21 #include "webrtc/base/scoped_ref_ptr.h" | 21 #include "webrtc/base/scoped_ref_ptr.h" |
22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
25 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 25 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
26 #include "webrtc/system_wrappers/include/tick_util.h" | 26 #include "webrtc/system_wrappers/include/tick_util.h" |
27 #include "webrtc/typedefs.h" | 27 #include "webrtc/typedefs.h" |
28 #include "webrtc/video/vie_receiver.h" | 28 #include "webrtc/video/rtp_stream_receiver.h" |
29 #include "webrtc/video/vie_sync_module.h" | 29 #include "webrtc/video/vie_sync_module.h" |
30 | 30 |
31 namespace webrtc { | 31 namespace webrtc { |
32 | 32 |
33 class CallStatsObserver; | 33 class CallStatsObserver; |
34 class ChannelStatsObserver; | 34 class ChannelStatsObserver; |
35 class Config; | 35 class Config; |
36 class EncodedImageCallback; | 36 class EncodedImageCallback; |
37 class I420FrameCallback; | 37 class I420FrameCallback; |
38 class IncomingVideoStream; | 38 class IncomingVideoStream; |
39 class PacedSender; | 39 class PacedSender; |
40 class PacketRouter; | 40 class PacketRouter; |
41 class PayloadRouter; | 41 class PayloadRouter; |
42 class ProcessThread; | |
43 class ReceiveStatisticsProxy; | 42 class ReceiveStatisticsProxy; |
44 class RtcpRttStats; | 43 class RtcpRttStats; |
45 class ViERTPObserver; | 44 class ViERTPObserver; |
46 class VideoRenderCallback; | 45 class VideoRenderCallback; |
47 class VoEVideoSync; | 46 class VoEVideoSync; |
48 | 47 |
49 namespace vcm { | 48 namespace vcm { |
50 class VideoReceiver; | 49 class VideoReceiver; |
51 } // namespace vcm | 50 } // namespace vcm |
52 | 51 |
53 enum StreamType { | 52 enum StreamType { |
54 kViEStreamTypeNormal = 0, // Normal media stream | 53 kViEStreamTypeNormal = 0, // Normal media stream |
55 kViEStreamTypeRtx = 1 // Retransmission media stream | 54 kViEStreamTypeRtx = 1 // Retransmission media stream |
56 }; | 55 }; |
57 | 56 |
58 class ViEChannel : public VCMFrameTypeCallback, | 57 class ViEChannel : public VCMFrameTypeCallback, |
59 public VCMReceiveCallback, | 58 public VCMReceiveCallback, |
60 public VCMReceiveStatisticsCallback, | 59 public VCMReceiveStatisticsCallback, |
61 public VCMDecoderTimingCallback, | 60 public VCMDecoderTimingCallback, |
62 public VCMPacketRequestCallback, | 61 public VCMPacketRequestCallback { |
63 public RtpFeedback { | |
64 public: | 62 public: |
65 friend class ChannelStatsObserver; | 63 friend class ChannelStatsObserver; |
66 | 64 |
67 ViEChannel(Transport* transport, | 65 ViEChannel(vcm::VideoReceiver* video_receiver, |
68 ProcessThread* module_process_thread, | 66 RtpStreamReceiver* rtp_stream_receiver); |
69 vcm::VideoReceiver* video_receiver, | |
70 RemoteBitrateEstimator* remote_bitrate_estimator, | |
71 RtcpRttStats* rtt_stats, | |
72 PacedSender* paced_sender, | |
73 PacketRouter* packet_router); | |
74 ~ViEChannel(); | 67 ~ViEChannel(); |
75 | 68 |
76 int32_t Init(); | 69 int32_t Init(); |
77 | 70 |
78 RtpRtcp* rtp_rtcp() const { return rtp_rtcp_; } | 71 RtpRtcp* rtp_rtcp() const { return rtp_rtcp_; } |
79 | 72 |
80 void SetProtectionMode(bool enable_nack, | 73 void SetProtectionMode(bool enable_nack, |
81 bool enable_fec, | 74 bool enable_fec, |
82 int payload_type_red, | 75 int payload_type_red, |
83 int payload_type_fec); | 76 int payload_type_fec); |
84 | 77 |
85 RtpState GetRtpStateForSsrc(uint32_t ssrc) const; | 78 RtpState GetRtpStateForSsrc(uint32_t ssrc) const; |
86 | 79 |
87 // Implements RtpFeedback. | |
88 int32_t OnInitializeDecoder(const int8_t payload_type, | |
89 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | |
90 const int frequency, | |
91 const size_t channels, | |
92 const uint32_t rate) override; | |
93 void OnIncomingSSRCChanged(const uint32_t ssrc) override; | |
94 void OnIncomingCSRCChanged(const uint32_t CSRC, const bool added) override; | |
95 | |
96 // Gets the module used by the channel. | |
97 ViEReceiver* vie_receiver(); | |
98 | 80 |
99 CallStatsObserver* GetStatsObserver(); | 81 CallStatsObserver* GetStatsObserver(); |
100 | 82 |
101 // Implements VCMReceiveCallback. | 83 // Implements VCMReceiveCallback. |
102 virtual int32_t FrameToRender(VideoFrame& video_frame); // NOLINT | 84 virtual int32_t FrameToRender(VideoFrame& video_frame); // NOLINT |
103 | 85 |
104 // Implements VCMReceiveCallback. | 86 // Implements VCMReceiveCallback. |
105 virtual int32_t ReceivedDecodedReferenceFrame( | 87 virtual int32_t ReceivedDecodedReferenceFrame( |
106 const uint64_t picture_id); | 88 const uint64_t picture_id); |
107 | 89 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 129 |
148 private: | 130 private: |
149 // Assumed to be protected. | 131 // Assumed to be protected. |
150 void StartDecodeThread(); | 132 void StartDecodeThread(); |
151 void StopDecodeThread(); | 133 void StopDecodeThread(); |
152 | 134 |
153 void ProcessNACKRequest(const bool enable); | 135 void ProcessNACKRequest(const bool enable); |
154 // Compute NACK list parameters for the buffering mode. | 136 // Compute NACK list parameters for the buffering mode. |
155 int GetRequiredNackListSize(int target_delay_ms); | 137 int GetRequiredNackListSize(int target_delay_ms); |
156 | 138 |
157 ProcessThread* const module_process_thread_; | |
158 | |
159 // Used for all registered callbacks except rendering. | 139 // Used for all registered callbacks except rendering. |
160 rtc::CriticalSection crit_; | 140 rtc::CriticalSection crit_; |
161 | 141 |
162 vcm::VideoReceiver* const video_receiver_; | 142 vcm::VideoReceiver* const video_receiver_; |
163 ViEReceiver vie_receiver_; | 143 RtpStreamReceiver* const rtp_stream_receiver_; |
164 RtpRtcp* const rtp_rtcp_; | 144 RtpRtcp* const rtp_rtcp_; |
165 | 145 |
166 // Helper to report call statistics. | 146 // Helper to report call statistics. |
167 std::unique_ptr<ChannelStatsObserver> stats_observer_; | 147 std::unique_ptr<ChannelStatsObserver> stats_observer_; |
168 | 148 |
169 // Not owned. | 149 // Not owned. |
170 ReceiveStatisticsProxy* receive_stats_callback_ GUARDED_BY(crit_); | 150 ReceiveStatisticsProxy* receive_stats_callback_ GUARDED_BY(crit_); |
171 FrameCounts receive_frame_counts_ GUARDED_BY(crit_); | 151 FrameCounts receive_frame_counts_ GUARDED_BY(crit_); |
172 IncomingVideoStream* incoming_video_stream_ GUARDED_BY(crit_); | 152 IncomingVideoStream* incoming_video_stream_ GUARDED_BY(crit_); |
173 | 153 |
174 int max_nack_reordering_threshold_; | 154 int max_nack_reordering_threshold_; |
175 I420FrameCallback* pre_render_callback_ GUARDED_BY(crit_); | 155 I420FrameCallback* pre_render_callback_ GUARDED_BY(crit_); |
176 | 156 |
177 int64_t last_rtt_ms_ GUARDED_BY(crit_); | 157 int64_t last_rtt_ms_ GUARDED_BY(crit_); |
178 }; | 158 }; |
179 | 159 |
180 } // namespace webrtc | 160 } // namespace webrtc |
181 | 161 |
182 #endif // WEBRTC_VIDEO_VIE_CHANNEL_H_ | 162 #endif // WEBRTC_VIDEO_VIE_CHANNEL_H_ |
OLD | NEW |