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

Side by Side Diff: remoting/protocol/sdp_message.h

Issue 2536623003: Add SdpHelper for more reliable codec configuration in WebrtcTransport. (Closed)
Patch Set: address feedback Created 4 years 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 | « remoting/protocol/BUILD.gn ('k') | remoting/protocol/sdp_message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_PROTOCOL_SDP_MESSAGE_H_
6 #define REMOTING_PROTOCOL_SDP_MESSAGE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12
13 namespace remoting {
14 namespace protocol {
15
16 // SdpMessage is used to process session descriptions messages in SDP format
17 // generated by WebRTC (see RFC 4566). In particularly it allows configuring
18 // video and audio codecs.
19 //
20 // It also normalizes the SDP message to make sure the text used for HMAC
21 // signature verification is the same that was signed on the sending side.
22 // This is necessary because WebRTC generates SDP with CRLF line endings which
23 // are sometimes converted to LF after passing the signaling channel.
24 class SdpMessage {
25 public:
26 explicit SdpMessage(const std::string& sdp);
27 ~SdpMessage();
28
29 bool has_audio() const { return has_audio_; }
30 bool has_video() const { return has_video_; }
31
32 // Returns string representation of the SDP message. The result always has
33 // line-endings normalized to LF and empty lines removed.
34 std::string ToString() const;
35
36 // Adds specified parameters for the |codec|. Returns false if the |codec| is
37 // not listed anywhere in the SDP message.
38 bool AddCodecParameter(const std::string& codec,
39 const std::string& parameters_to_add);
40
41 private:
42 // Finds the line of the form "a=rtpmap:<payload_type> <codec>/.." with the
43 // specified |codec|. Sets |line_num| to line number and |payload_type| to the
44 // payload type from that line. Returns false if the codec wasn't found.
45 bool FindCodec(const std::string& codec,
46 int* line_num,
47 std::string* payload_type) const;
48
49 std::vector<std::string> sdp_lines_;
50
51 bool has_audio_ = false;
52 bool has_video_ = false;
53
54 DISALLOW_COPY_AND_ASSIGN(SdpMessage);
55 };
56
57 } // namespace protocol
58 } // namespace remoting
59
60 #endif // REMOTING_PROTOCOL_SDP_MESSAGE_H_
OLDNEW
« no previous file with comments | « remoting/protocol/BUILD.gn ('k') | remoting/protocol/sdp_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698