| 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 | 29 |
| 30 // PayloadRouter routes outgoing data to the correct sending RTP module, based | 30 // PayloadRouter routes outgoing data to the correct sending RTP module, based |
| 31 // on the simulcast layer in RTPVideoHeader. | 31 // on the simulcast layer in RTPVideoHeader. |
| 32 class PayloadRouter : public EncodedImageCallback { | 32 class PayloadRouter : public EncodedImageCallback { |
| 33 public: | 33 public: |
| 34 // Rtp modules are assumed to be sorted in simulcast index order. | 34 // Rtp modules are assumed to be sorted in simulcast index order. |
| 35 PayloadRouter(const std::vector<RtpRtcp*>& rtp_modules, | 35 PayloadRouter(const std::vector<RtpRtcp*>& rtp_modules, |
| 36 int payload_type); | 36 int payload_type); |
| 37 ~PayloadRouter(); | 37 ~PayloadRouter(); |
| 38 | 38 |
| 39 static size_t DefaultMaxPayloadLength(); | |
| 40 | |
| 41 // PayloadRouter will only route packets if being active, all packets will be | 39 // PayloadRouter will only route packets if being active, all packets will be |
| 42 // dropped otherwise. | 40 // dropped otherwise. |
| 43 void SetActive(bool active); | 41 void SetActive(bool active); |
| 44 bool IsActive(); | 42 bool IsActive(); |
| 45 | 43 |
| 46 // Implements EncodedImageCallback. | 44 // Implements EncodedImageCallback. |
| 47 // Returns 0 if the packet was routed / sent, -1 otherwise. | 45 // Returns 0 if the packet was routed / sent, -1 otherwise. |
| 48 EncodedImageCallback::Result OnEncodedImage( | 46 EncodedImageCallback::Result OnEncodedImage( |
| 49 const EncodedImage& encoded_image, | 47 const EncodedImage& encoded_image, |
| 50 const CodecSpecificInfo* codec_specific_info, | 48 const CodecSpecificInfo* codec_specific_info, |
| 51 const RTPFragmentationHeader* fragmentation) override; | 49 const RTPFragmentationHeader* fragmentation) override; |
| 52 | 50 |
| 53 // Returns the maximum allowed data payload length, given the configured MTU | |
| 54 // and RTP headers. | |
| 55 size_t MaxPayloadLength() const; | |
| 56 | |
| 57 void OnBitrateAllocationUpdated(const BitrateAllocation& bitrate); | 51 void OnBitrateAllocationUpdated(const BitrateAllocation& bitrate); |
| 58 | 52 |
| 59 private: | 53 private: |
| 60 void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 54 void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 61 | 55 |
| 62 rtc::CriticalSection crit_; | 56 rtc::CriticalSection crit_; |
| 63 bool active_ GUARDED_BY(crit_); | 57 bool active_ GUARDED_BY(crit_); |
| 64 | 58 |
| 65 // Rtp modules are assumed to be sorted in simulcast index order. Not owned. | 59 // Rtp modules are assumed to be sorted in simulcast index order. Not owned. |
| 66 const std::vector<RtpRtcp*> rtp_modules_; | 60 const std::vector<RtpRtcp*> rtp_modules_; |
| 67 const int payload_type_; | 61 const int payload_type_; |
| 68 | 62 |
| 69 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter); | 63 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter); |
| 70 }; | 64 }; |
| 71 | 65 |
| 72 } // namespace webrtc | 66 } // namespace webrtc |
| 73 | 67 |
| 74 #endif // WEBRTC_VIDEO_PAYLOAD_ROUTER_H_ | 68 #endif // WEBRTC_VIDEO_PAYLOAD_ROUTER_H_ |
| OLD | NEW |