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

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

Issue 1912653002: Remove PayloadRouter dependency from ViEEncoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments. Created 4 years, 7 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
« no previous file with comments | « webrtc/video/encoder_state_feedback_unittest.cc ('k') | webrtc/video/payload_router.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #ifndef WEBRTC_VIDEO_PAYLOAD_ROUTER_H_ 11 #ifndef WEBRTC_VIDEO_PAYLOAD_ROUTER_H_
12 #define WEBRTC_VIDEO_PAYLOAD_ROUTER_H_ 12 #define WEBRTC_VIDEO_PAYLOAD_ROUTER_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/constructormagic.h" 16 #include "webrtc/base/constructormagic.h"
17 #include "webrtc/base/criticalsection.h" 17 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/thread_annotations.h" 18 #include "webrtc/base/thread_annotations.h"
19 #include "webrtc/common_types.h" 19 #include "webrtc/common_types.h"
20 #include "webrtc/config.h"
20 #include "webrtc/video_encoder.h" 21 #include "webrtc/video_encoder.h"
21 #include "webrtc/system_wrappers/include/atomic32.h" 22 #include "webrtc/system_wrappers/include/atomic32.h"
22 23
23 namespace webrtc { 24 namespace webrtc {
24 25
25 class RTPFragmentationHeader; 26 class RTPFragmentationHeader;
26 class RtpRtcp; 27 class RtpRtcp;
27 struct RTPVideoHeader; 28 struct RTPVideoHeader;
28 29
29 // PayloadRouter routes outgoing data to the correct sending RTP module, based 30 // PayloadRouter routes outgoing data to the correct sending RTP module, based
30 // on the simulcast layer in RTPVideoHeader. 31 // on the simulcast layer in RTPVideoHeader.
31 class PayloadRouter : public EncodedImageCallback { 32 class PayloadRouter : public EncodedImageCallback {
32 public: 33 public:
33 // Rtp modules are assumed to be sorted in simulcast index order. 34 // Rtp modules are assumed to be sorted in simulcast index order.
34 explicit PayloadRouter(const std::vector<RtpRtcp*>& rtp_modules, 35 explicit PayloadRouter(const std::vector<RtpRtcp*>& rtp_modules,
35 int payload_type); 36 int payload_type);
36 ~PayloadRouter(); 37 ~PayloadRouter();
37 38
38 static size_t DefaultMaxPayloadLength(); 39 static size_t DefaultMaxPayloadLength();
39 void SetSendingRtpModules(size_t num_sending_modules); 40 void SetSendStreams(const std::vector<VideoStream>& streams);
40 41
41 // PayloadRouter will only route packets if being active, all packets will be 42 // PayloadRouter will only route packets if being active, all packets will be
42 // dropped otherwise. 43 // dropped otherwise.
43 void set_active(bool active); 44 void set_active(bool active);
44 bool active(); 45 bool active();
45 46
46 // Implements EncodedImageCallback. 47 // Implements EncodedImageCallback.
47 // Returns 0 if the packet was routed / sent, -1 otherwise. 48 // Returns 0 if the packet was routed / sent, -1 otherwise.
48 int32_t Encoded(const EncodedImage& encoded_image, 49 int32_t Encoded(const EncodedImage& encoded_image,
49 const CodecSpecificInfo* codec_specific_info, 50 const CodecSpecificInfo* codec_specific_info,
50 const RTPFragmentationHeader* fragmentation) override; 51 const RTPFragmentationHeader* fragmentation) override;
51 52
52 // Configures current target bitrate per module. 'stream_bitrates' is assumed 53 // Configures current target bitrate.
53 // to be in the same order as 'SetSendingRtpModules'. 54 void SetTargetSendBitrate(uint32_t bitrate_bps);
54 void SetTargetSendBitrates(const std::vector<uint32_t>& stream_bitrates);
55 55
56 // Returns the maximum allowed data payload length, given the configured MTU 56 // Returns the maximum allowed data payload length, given the configured MTU
57 // and RTP headers. 57 // and RTP headers.
58 size_t MaxPayloadLength() const; 58 size_t MaxPayloadLength() const;
59 59
60 private: 60 private:
61 void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_); 61 void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_);
62 62
63 rtc::CriticalSection crit_; 63 rtc::CriticalSection crit_;
64 bool active_ GUARDED_BY(crit_); 64 bool active_ GUARDED_BY(crit_);
65 std::vector<VideoStream> streams_ GUARDED_BY(crit_);
65 size_t num_sending_modules_ GUARDED_BY(crit_); 66 size_t num_sending_modules_ GUARDED_BY(crit_);
66 67
67 // Rtp modules are assumed to be sorted in simulcast index order. Not owned. 68 // Rtp modules are assumed to be sorted in simulcast index order. Not owned.
68 const std::vector<RtpRtcp*> rtp_modules_; 69 const std::vector<RtpRtcp*> rtp_modules_;
69 const int payload_type_; 70 const int payload_type_;
70 71
71 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter); 72 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter);
72 }; 73 };
73 74
74 } // namespace webrtc 75 } // namespace webrtc
75 76
76 #endif // WEBRTC_VIDEO_PAYLOAD_ROUTER_H_ 77 #endif // WEBRTC_VIDEO_PAYLOAD_ROUTER_H_
OLDNEW
« no previous file with comments | « webrtc/video/encoder_state_feedback_unittest.cc ('k') | webrtc/video/payload_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698