Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: webrtc/video/payload_router.h

Issue 1725363003: Move RTP module activation into PayloadRouter. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 18 matching lines...) Expand all
29 // PayloadRouter routes outgoing data to the correct sending RTP module, based 29 // PayloadRouter routes outgoing data to the correct sending RTP module, based
30 // on the simulcast layer in RTPVideoHeader. 30 // on the simulcast layer in RTPVideoHeader.
31 class PayloadRouter { 31 class PayloadRouter {
32 public: 32 public:
33 PayloadRouter(); 33 PayloadRouter();
34 ~PayloadRouter(); 34 ~PayloadRouter();
35 35
36 static size_t DefaultMaxPayloadLength(); 36 static size_t DefaultMaxPayloadLength();
37 37
38 // Rtp modules are assumed to be sorted in simulcast index order. 38 // Rtp modules are assumed to be sorted in simulcast index order.
39 void SetSendingRtpModules(const std::vector<RtpRtcp*>& rtp_modules); 39 void Init(const std::vector<RtpRtcp*>& rtp_modules);
40
41 void SetSendingRtpModules(size_t num_sending_modules);
40 42
41 // PayloadRouter will only route packets if being active, all packets will be 43 // PayloadRouter will only route packets if being active, all packets will be
42 // dropped otherwise. 44 // dropped otherwise.
43 void set_active(bool active); 45 void set_active(bool active);
44 bool active(); 46 bool active();
45 47
46 // Input parameters according to the signature of RtpRtcp::SendOutgoingData. 48 // Input parameters according to the signature of RtpRtcp::SendOutgoingData.
47 // Returns true if the packet was routed / sent, false otherwise. 49 // Returns true if the packet was routed / sent, false otherwise.
48 bool RoutePayload(FrameType frame_type, 50 bool RoutePayload(FrameType frame_type,
49 int8_t payload_type, 51 int8_t payload_type,
50 uint32_t time_stamp, 52 uint32_t time_stamp,
51 int64_t capture_time_ms, 53 int64_t capture_time_ms,
52 const uint8_t* payload_data, 54 const uint8_t* payload_data,
53 size_t payload_size, 55 size_t payload_size,
54 const RTPFragmentationHeader* fragmentation, 56 const RTPFragmentationHeader* fragmentation,
55 const RTPVideoHeader* rtp_video_hdr); 57 const RTPVideoHeader* rtp_video_hdr);
56 58
57 // Configures current target bitrate per module. 'stream_bitrates' is assumed 59 // Configures current target bitrate per module. 'stream_bitrates' is assumed
58 // to be in the same order as 'SetSendingRtpModules'. 60 // to be in the same order as 'SetSendingRtpModules'.
59 void SetTargetSendBitrates(const std::vector<uint32_t>& stream_bitrates); 61 void SetTargetSendBitrates(const std::vector<uint32_t>& stream_bitrates);
60 62
61 // Returns the maximum allowed data payload length, given the configured MTU 63 // Returns the maximum allowed data payload length, given the configured MTU
62 // and RTP headers. 64 // and RTP headers.
63 size_t MaxPayloadLength() const; 65 size_t MaxPayloadLength() const;
64 66
65 void AddRef() { ++ref_count_; }
66 void Release() { if (--ref_count_ == 0) { delete this; } }
67
68 private: 67 private:
68 void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_);
69 // TODO(mflodman): When the new video API has launched, remove crit_ and 69 // TODO(mflodman): When the new video API has launched, remove crit_ and
70 // assume rtp_modules_ will never change during a call. 70 // assume rtp_modules_ will never change during a call.
71 rtc::CriticalSection crit_; 71 rtc::CriticalSection crit_;
72 72
73 // TODO(pbos): Set once and for all on construction.
74 std::vector<RtpRtcp*> rtp_modules_;
75
76 bool active_ GUARDED_BY(crit_);
73 // Active sending RTP modules, in layer order. 77 // Active sending RTP modules, in layer order.
stefan-webrtc 2016/02/26 14:49:07 Maybe move this to before the vector?
pbos-webrtc 2016/02/26 14:58:56 Want them to be lumped with the crit_ that protect
74 std::vector<RtpRtcp*> rtp_modules_ GUARDED_BY(crit_); 78 size_t num_sending_modules_ GUARDED_BY(crit_);
75 bool active_ GUARDED_BY(crit_);
76
77 Atomic32 ref_count_;
78 79
79 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter); 80 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter);
80 }; 81 };
81 82
82 } // namespace webrtc 83 } // namespace webrtc
83 84
84 #endif // WEBRTC_VIDEO_PAYLOAD_ROUTER_H_ 85 #endif // WEBRTC_VIDEO_PAYLOAD_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698