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