OLD | NEW |
---|---|
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 Loading... | |
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 : public EncodedImageCallback { | 31 class PayloadRouter : public EncodedImageCallback { |
32 public: | 32 public: |
33 // Rtp modules are assumed to be sorted in simulcast index order. | 33 // Rtp modules are assumed to be sorted in simulcast index order. |
34 explicit PayloadRouter(const std::vector<RtpRtcp*>& rtp_modules, | 34 explicit PayloadRouter(const std::vector<RtpRtcp*>& rtp_modules, |
35 int payload_type); | 35 int payload_type); |
36 ~PayloadRouter(); | 36 ~PayloadRouter(); |
37 | 37 |
38 static size_t DefaultMaxPayloadLength(); | 38 static size_t DefaultMaxPayloadLength(); |
39 void SetSendingRtpModules(size_t num_sending_modules); | 39 void SetSendCodec(const VideoCodec& codec); |
pbos-webrtc
2016/04/22 15:24:20
Can this take a std::vector<VideoStream> instead?
perkj_webrtc
2016/04/27 08:00:57
ok- but I had to add the streams to the EncoderCon
| |
40 | 40 |
41 // PayloadRouter will only route packets if being active, all packets will be | 41 // PayloadRouter will only route packets if being active, all packets will be |
42 // dropped otherwise. | 42 // dropped otherwise. |
43 void set_active(bool active); | 43 void set_active(bool active); |
44 bool active(); | 44 bool active(); |
45 | 45 |
46 // Implements EncodedImageCallback. | 46 // Implements EncodedImageCallback. |
47 // Returns 0 if the packet was routed / sent, -1 otherwise. | 47 // Returns 0 if the packet was routed / sent, -1 otherwise. |
48 int32_t Encoded(const EncodedImage& encoded_image, | 48 int32_t Encoded(const EncodedImage& encoded_image, |
49 const CodecSpecificInfo* codec_specific_info, | 49 const CodecSpecificInfo* codec_specific_info, |
50 const RTPFragmentationHeader* fragmentation) override; | 50 const RTPFragmentationHeader* fragmentation) override; |
51 | 51 |
52 // Configures current target bitrate per module. 'stream_bitrates' is assumed | 52 // Configures current target bitrate. |
53 // to be in the same order as 'SetSendingRtpModules'. | 53 void SetTargetSendBitrate(uint32_t bitrate_bps); |
54 void SetTargetSendBitrates(const std::vector<uint32_t>& stream_bitrates); | |
55 | 54 |
56 // Returns the maximum allowed data payload length, given the configured MTU | 55 // Returns the maximum allowed data payload length, given the configured MTU |
57 // and RTP headers. | 56 // and RTP headers. |
58 size_t MaxPayloadLength() const; | 57 size_t MaxPayloadLength() const; |
59 | 58 |
60 private: | 59 private: |
61 void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 60 void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
62 | 61 |
63 rtc::CriticalSection crit_; | 62 rtc::CriticalSection crit_; |
64 bool active_ GUARDED_BY(crit_); | 63 bool active_ GUARDED_BY(crit_); |
64 VideoCodec codec_ GUARDED_BY(crit_); | |
65 size_t num_sending_modules_ GUARDED_BY(crit_); | 65 size_t num_sending_modules_ GUARDED_BY(crit_); |
66 | 66 |
67 // Rtp modules are assumed to be sorted in simulcast index order. Not owned. | 67 // Rtp modules are assumed to be sorted in simulcast index order. Not owned. |
68 const std::vector<RtpRtcp*> rtp_modules_; | 68 const std::vector<RtpRtcp*> rtp_modules_; |
69 const int payload_type_; | 69 const int payload_type_; |
70 | 70 |
71 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter); | 71 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter); |
72 }; | 72 }; |
73 | 73 |
74 } // namespace webrtc | 74 } // namespace webrtc |
75 | 75 |
76 #endif // WEBRTC_VIDEO_PAYLOAD_ROUTER_H_ | 76 #endif // WEBRTC_VIDEO_PAYLOAD_ROUTER_H_ |
OLD | NEW |