OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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_MEDIA_BASE_RTPDATAENGINE_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_RTPDATAENGINE_H_ |
12 #define WEBRTC_MEDIA_BASE_RTPDATAENGINE_H_ | 12 #define WEBRTC_MEDIA_BASE_RTPDATAENGINE_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/media/base/mediachannel.h" | 18 #include "webrtc/media/base/mediachannel.h" |
19 #include "webrtc/media/base/mediaconstants.h" | 19 #include "webrtc/media/base/mediaconstants.h" |
20 #include "webrtc/media/base/mediaengine.h" | 20 #include "webrtc/media/base/mediaengine.h" |
21 | 21 |
22 namespace cricket { | 22 namespace cricket { |
23 | 23 |
24 struct DataCodec; | 24 struct DataCodec; |
25 | 25 |
26 class RtpDataEngine : public DataEngineInterface { | 26 class RtpDataEngine : public DataEngineInterface { |
27 public: | 27 public: |
28 RtpDataEngine(); | 28 RtpDataEngine(); |
29 | 29 |
30 virtual DataMediaChannel* CreateChannel(DataChannelType data_channel_type); | 30 virtual DataMediaChannel* CreateChannel(DataChannelType data_channel_type, |
| 31 const MediaConfig& config); |
31 | 32 |
32 virtual const std::vector<DataCodec>& data_codecs() { | 33 virtual const std::vector<DataCodec>& data_codecs() { |
33 return data_codecs_; | 34 return data_codecs_; |
34 } | 35 } |
35 | 36 |
36 private: | 37 private: |
37 std::vector<DataCodec> data_codecs_; | 38 std::vector<DataCodec> data_codecs_; |
38 }; | 39 }; |
39 | 40 |
40 // Keep track of sequence number and timestamp of an RTP stream. The | 41 // Keep track of sequence number and timestamp of an RTP stream. The |
(...skipping 13 matching lines...) Expand all Loading... |
54 void Tick(double now, int* seq_num, uint32_t* timestamp); | 55 void Tick(double now, int* seq_num, uint32_t* timestamp); |
55 | 56 |
56 private: | 57 private: |
57 int clockrate_; | 58 int clockrate_; |
58 uint16_t last_seq_num_; | 59 uint16_t last_seq_num_; |
59 uint32_t timestamp_offset_; | 60 uint32_t timestamp_offset_; |
60 }; | 61 }; |
61 | 62 |
62 class RtpDataMediaChannel : public DataMediaChannel { | 63 class RtpDataMediaChannel : public DataMediaChannel { |
63 public: | 64 public: |
64 RtpDataMediaChannel(); | 65 RtpDataMediaChannel(const MediaConfig& config); |
65 virtual ~RtpDataMediaChannel(); | 66 virtual ~RtpDataMediaChannel(); |
66 | 67 |
67 virtual bool SetSendParameters(const DataSendParameters& params); | 68 virtual bool SetSendParameters(const DataSendParameters& params); |
68 virtual bool SetRecvParameters(const DataRecvParameters& params); | 69 virtual bool SetRecvParameters(const DataRecvParameters& params); |
69 virtual bool AddSendStream(const StreamParams& sp); | 70 virtual bool AddSendStream(const StreamParams& sp); |
70 virtual bool RemoveSendStream(uint32_t ssrc); | 71 virtual bool RemoveSendStream(uint32_t ssrc); |
71 virtual bool AddRecvStream(const StreamParams& sp); | 72 virtual bool AddRecvStream(const StreamParams& sp); |
72 virtual bool RemoveRecvStream(uint32_t ssrc); | 73 virtual bool RemoveRecvStream(uint32_t ssrc); |
73 virtual bool SetSend(bool send) { | 74 virtual bool SetSend(bool send) { |
74 sending_ = send; | 75 sending_ = send; |
75 return true; | 76 return true; |
76 } | 77 } |
77 virtual bool SetReceive(bool receive) { | 78 virtual bool SetReceive(bool receive) { |
78 receiving_ = receive; | 79 receiving_ = receive; |
79 return true; | 80 return true; |
80 } | 81 } |
81 virtual void OnPacketReceived(rtc::CopyOnWriteBuffer* packet, | 82 virtual void OnPacketReceived(rtc::CopyOnWriteBuffer* packet, |
82 const rtc::PacketTime& packet_time); | 83 const rtc::PacketTime& packet_time); |
83 virtual void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet, | 84 virtual void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet, |
84 const rtc::PacketTime& packet_time) {} | 85 const rtc::PacketTime& packet_time) {} |
85 virtual void OnReadyToSend(bool ready) {} | 86 virtual void OnReadyToSend(bool ready) {} |
86 virtual void OnTransportOverheadChanged(int transport_overhead_per_packet) {} | 87 virtual void OnTransportOverheadChanged(int transport_overhead_per_packet) {} |
87 virtual bool SendData( | 88 virtual bool SendData( |
88 const SendDataParams& params, | 89 const SendDataParams& params, |
89 const rtc::CopyOnWriteBuffer& payload, | 90 const rtc::CopyOnWriteBuffer& payload, |
90 SendDataResult* result); | 91 SendDataResult* result); |
| 92 virtual rtc::DiffServCodePoint PreferredDscp() const; |
91 | 93 |
92 private: | 94 private: |
93 void Construct(); | 95 void Construct(); |
94 bool SetMaxSendBandwidth(int bps); | 96 bool SetMaxSendBandwidth(int bps); |
95 bool SetSendCodecs(const std::vector<DataCodec>& codecs); | 97 bool SetSendCodecs(const std::vector<DataCodec>& codecs); |
96 bool SetRecvCodecs(const std::vector<DataCodec>& codecs); | 98 bool SetRecvCodecs(const std::vector<DataCodec>& codecs); |
97 | 99 |
98 bool sending_; | 100 bool sending_; |
99 bool receiving_; | 101 bool receiving_; |
100 std::vector<DataCodec> send_codecs_; | 102 std::vector<DataCodec> send_codecs_; |
101 std::vector<DataCodec> recv_codecs_; | 103 std::vector<DataCodec> recv_codecs_; |
102 std::vector<StreamParams> send_streams_; | 104 std::vector<StreamParams> send_streams_; |
103 std::vector<StreamParams> recv_streams_; | 105 std::vector<StreamParams> recv_streams_; |
104 std::map<uint32_t, RtpClock*> rtp_clock_by_send_ssrc_; | 106 std::map<uint32_t, RtpClock*> rtp_clock_by_send_ssrc_; |
105 std::unique_ptr<rtc::RateLimiter> send_limiter_; | 107 std::unique_ptr<rtc::RateLimiter> send_limiter_; |
106 }; | 108 }; |
107 | 109 |
108 } // namespace cricket | 110 } // namespace cricket |
109 | 111 |
110 #endif // WEBRTC_MEDIA_BASE_RTPDATAENGINE_H_ | 112 #endif // WEBRTC_MEDIA_BASE_RTPDATAENGINE_H_ |
OLD | NEW |