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

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

Issue 1897233002: Deprecate VCMPacketizationCallback::SendData and use EncodedImageCallback instead. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed pbos nits. Created 4 years, 8 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/video_encoder.h"
20 #include "webrtc/system_wrappers/include/atomic32.h" 21 #include "webrtc/system_wrappers/include/atomic32.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 class RTPFragmentationHeader; 25 class RTPFragmentationHeader;
25 class RtpRtcp; 26 class RtpRtcp;
26 struct RTPVideoHeader; 27 struct RTPVideoHeader;
27 28
28 // PayloadRouter routes outgoing data to the correct sending RTP module, based 29 // PayloadRouter routes outgoing data to the correct sending RTP module, based
29 // on the simulcast layer in RTPVideoHeader. 30 // on the simulcast layer in RTPVideoHeader.
30 class PayloadRouter { 31 class PayloadRouter : public EncodedImageCallback {
31 public: 32 public:
32 // Rtp modules are assumed to be sorted in simulcast index order. 33 // Rtp modules are assumed to be sorted in simulcast index order.
33 explicit PayloadRouter(const std::vector<RtpRtcp*>& rtp_modules); 34 explicit PayloadRouter(const std::vector<RtpRtcp*>& rtp_modules,
35 int payload_type);
34 ~PayloadRouter(); 36 ~PayloadRouter();
35 37
36 static size_t DefaultMaxPayloadLength(); 38 static size_t DefaultMaxPayloadLength();
37 void SetSendingRtpModules(size_t num_sending_modules); 39 void SetSendingRtpModules(size_t num_sending_modules);
38 40
39 // 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
40 // dropped otherwise. 42 // dropped otherwise.
41 void set_active(bool active); 43 void set_active(bool active);
42 bool active(); 44 bool active();
43 45
44 // Input parameters according to the signature of RtpRtcp::SendOutgoingData. 46 // Implements EncodedImageCallback.
45 // Returns true if the packet was routed / sent, false otherwise. 47 // Returns 0 if the packet was routed / sent, -1 otherwise.
46 bool RoutePayload(FrameType frame_type, 48 int32_t Encoded(const EncodedImage& encoded_image,
47 int8_t payload_type, 49 const CodecSpecificInfo* codec_specific_info,
48 uint32_t time_stamp, 50 const RTPFragmentationHeader* fragmentation) override;
49 int64_t capture_time_ms,
50 const uint8_t* payload_data,
51 size_t payload_size,
52 const RTPFragmentationHeader* fragmentation,
53 const RTPVideoHeader* rtp_video_hdr);
54 51
55 // Configures current target bitrate per module. 'stream_bitrates' is assumed 52 // Configures current target bitrate per module. 'stream_bitrates' is assumed
56 // to be in the same order as 'SetSendingRtpModules'. 53 // to be in the same order as 'SetSendingRtpModules'.
57 void SetTargetSendBitrates(const std::vector<uint32_t>& stream_bitrates); 54 void SetTargetSendBitrates(const std::vector<uint32_t>& stream_bitrates);
58 55
59 // Returns the maximum allowed data payload length, given the configured MTU 56 // Returns the maximum allowed data payload length, given the configured MTU
60 // and RTP headers. 57 // and RTP headers.
61 size_t MaxPayloadLength() const; 58 size_t MaxPayloadLength() const;
62 59
63 private: 60 private:
64 void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_); 61 void UpdateModuleSendingState() EXCLUSIVE_LOCKS_REQUIRED(crit_);
65 62
66 rtc::CriticalSection crit_; 63 rtc::CriticalSection crit_;
67 bool active_ GUARDED_BY(crit_); 64 bool active_ GUARDED_BY(crit_);
68 size_t num_sending_modules_ GUARDED_BY(crit_); 65 size_t num_sending_modules_ GUARDED_BY(crit_);
69 66
70 // 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.
71 const std::vector<RtpRtcp*> rtp_modules_; 68 const std::vector<RtpRtcp*> rtp_modules_;
69 const int payload_type_;
72 70
73 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter); 71 RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter);
74 }; 72 };
75 73
76 } // namespace webrtc 74 } // namespace webrtc
77 75
78 #endif // WEBRTC_VIDEO_PAYLOAD_ROUTER_H_ 76 #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