Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Find the line in form of "a=rtpmap:<payload_type> <codec>/.." with the | |
| 2 // specified |codec|. Sets |line_num| to line number and |payload_type| to the | |
| 3 // payload type from that line. Returns false if the codec wasn't found. | |
| 4 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 5 // Use of this source code is governed by a BSD-style license that can be | |
| 6 // found in the LICENSE file. | |
| 7 | |
| 8 #ifndef REMOTING_PROTOCOL_SDP_HELPER_H_ | |
| 9 #define REMOTING_PROTOCOL_SDP_HELPER_H_ | |
| 10 | |
| 11 #include <string> | |
| 12 #include <vector> | |
| 13 | |
| 14 #include "base/macros.h" | |
| 15 | |
| 16 namespace remoting { | |
| 17 namespace protocol { | |
| 18 | |
| 19 // SdpHelper is used to process SDP session descriptions generated by WebRTC, | |
|
Jamie
2016/11/28 21:02:52
Maybe define SDP the first time you use it.
Sergey Ulanov
2016/11/28 22:45:08
Done.
| |
| 20 // and particularly to configure desired video and audio codecs. | |
| 21 // | |
| 22 // It also normalizes the SDP message to make sure the text used for HMAC | |
| 23 // signatures verifications is the same that was signed on the sending side. | |
|
Jamie
2016/11/28 21:02:52
s/signatures verifications/signature verification/
Sergey Ulanov
2016/11/28 22:45:08
Done.
| |
| 24 // This is necessary because WebRTC generates SDP with CRLF line endings which | |
| 25 // are sometimes converted to LF after passing the signaling channel. | |
| 26 class SdpHelper { | |
|
Jamie
2016/11/28 21:02:52
*Helper is a bit generic as a name. If this encaps
Sergey Ulanov
2016/11/28 22:45:09
Done.
| |
| 27 public: | |
| 28 explicit SdpHelper(const std::string& sdp); | |
| 29 ~SdpHelper(); | |
| 30 | |
| 31 bool has_audio() const { return has_audio_; } | |
| 32 bool has_video() const { return has_video_; } | |
| 33 | |
| 34 // Returns string representation of the SDP. The result always has | |
|
Jamie
2016/11/28 21:02:52
s/SDP/SDP message/
Sergey Ulanov
2016/11/28 22:45:08
Done.
| |
| 35 // line-endings normalized and empty lines removed. | |
|
Jamie
2016/11/28 21:02:52
Be specific about what the normalized line-endings
Sergey Ulanov
2016/11/28 22:45:08
The client normalizes with LF, so changing it to C
| |
| 36 std::string ToString() const; | |
| 37 | |
| 38 // Adds specified parameters for the |codec|. Returns false if the |codec| is | |
| 39 // not listed anywhere in SDP. | |
|
Jamie
2016/11/28 21:02:52
s/SDP/the SDP message/
Sergey Ulanov
2016/11/28 22:45:09
Done.
| |
| 40 bool AddCodecParameter(const std::string& codec, | |
| 41 const std::string& parameters_to_add); | |
| 42 | |
| 43 private: | |
| 44 // Find the line in form of "a=rtpmap:<payload_type> <codec>/.." with the | |
|
Jamie
2016/11/28 21:02:52
s/in form of/of the form/
Sergey Ulanov
2016/11/28 22:45:08
Done.
| |
| 45 // specified |codec|. Sets |line_num| to line number and |payload_type| to the | |
| 46 // payload type from that line. Returns false if the codec wasn't found. | |
| 47 bool FindCodec(const std::string& codec, | |
| 48 int* line_num, | |
| 49 std::string* payload_type) const; | |
| 50 | |
| 51 std::vector<std::string> sdp_lines_; | |
| 52 | |
| 53 bool has_audio_ = false; | |
| 54 bool has_video_ = false; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(SdpHelper); | |
| 57 }; | |
| 58 | |
| 59 } // namespace protocol | |
| 60 } // namespace remoting | |
| 61 | |
| 62 #endif // REMOTING_PROTOCOL_SDP_HELPER_H_ | |
| OLD | NEW |