xref: /aosp_15_r20/external/webrtc/pc/session_description.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright 2010 The WebRTC Project Authors. All rights reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker 
11*d9f75844SAndroid Build Coastguard Worker #include "pc/session_description.h"
12*d9f75844SAndroid Build Coastguard Worker 
13*d9f75844SAndroid Build Coastguard Worker #include "absl/algorithm/container.h"
14*d9f75844SAndroid Build Coastguard Worker #include "absl/memory/memory.h"
15*d9f75844SAndroid Build Coastguard Worker #include "rtc_base/checks.h"
16*d9f75844SAndroid Build Coastguard Worker #include "rtc_base/strings/string_builder.h"
17*d9f75844SAndroid Build Coastguard Worker 
18*d9f75844SAndroid Build Coastguard Worker namespace cricket {
19*d9f75844SAndroid Build Coastguard Worker namespace {
20*d9f75844SAndroid Build Coastguard Worker 
FindContentInfoByName(ContentInfos * contents,const std::string & name)21*d9f75844SAndroid Build Coastguard Worker ContentInfo* FindContentInfoByName(ContentInfos* contents,
22*d9f75844SAndroid Build Coastguard Worker                                    const std::string& name) {
23*d9f75844SAndroid Build Coastguard Worker   RTC_DCHECK(contents);
24*d9f75844SAndroid Build Coastguard Worker   for (ContentInfo& content : *contents) {
25*d9f75844SAndroid Build Coastguard Worker     if (content.name == name) {
26*d9f75844SAndroid Build Coastguard Worker       return &content;
27*d9f75844SAndroid Build Coastguard Worker     }
28*d9f75844SAndroid Build Coastguard Worker   }
29*d9f75844SAndroid Build Coastguard Worker   return nullptr;
30*d9f75844SAndroid Build Coastguard Worker }
31*d9f75844SAndroid Build Coastguard Worker 
32*d9f75844SAndroid Build Coastguard Worker }  // namespace
33*d9f75844SAndroid Build Coastguard Worker 
FindContentInfoByName(const ContentInfos & contents,const std::string & name)34*d9f75844SAndroid Build Coastguard Worker const ContentInfo* FindContentInfoByName(const ContentInfos& contents,
35*d9f75844SAndroid Build Coastguard Worker                                          const std::string& name) {
36*d9f75844SAndroid Build Coastguard Worker   for (ContentInfos::const_iterator content = contents.begin();
37*d9f75844SAndroid Build Coastguard Worker        content != contents.end(); ++content) {
38*d9f75844SAndroid Build Coastguard Worker     if (content->name == name) {
39*d9f75844SAndroid Build Coastguard Worker       return &(*content);
40*d9f75844SAndroid Build Coastguard Worker     }
41*d9f75844SAndroid Build Coastguard Worker   }
42*d9f75844SAndroid Build Coastguard Worker   return NULL;
43*d9f75844SAndroid Build Coastguard Worker }
44*d9f75844SAndroid Build Coastguard Worker 
FindContentInfoByType(const ContentInfos & contents,MediaProtocolType type)45*d9f75844SAndroid Build Coastguard Worker const ContentInfo* FindContentInfoByType(const ContentInfos& contents,
46*d9f75844SAndroid Build Coastguard Worker                                          MediaProtocolType type) {
47*d9f75844SAndroid Build Coastguard Worker   for (const auto& content : contents) {
48*d9f75844SAndroid Build Coastguard Worker     if (content.type == type) {
49*d9f75844SAndroid Build Coastguard Worker       return &content;
50*d9f75844SAndroid Build Coastguard Worker     }
51*d9f75844SAndroid Build Coastguard Worker   }
52*d9f75844SAndroid Build Coastguard Worker   return nullptr;
53*d9f75844SAndroid Build Coastguard Worker }
54*d9f75844SAndroid Build Coastguard Worker 
ContentGroup(const std::string & semantics)55*d9f75844SAndroid Build Coastguard Worker ContentGroup::ContentGroup(const std::string& semantics)
56*d9f75844SAndroid Build Coastguard Worker     : semantics_(semantics) {}
57*d9f75844SAndroid Build Coastguard Worker 
58*d9f75844SAndroid Build Coastguard Worker ContentGroup::ContentGroup(const ContentGroup&) = default;
59*d9f75844SAndroid Build Coastguard Worker ContentGroup::ContentGroup(ContentGroup&&) = default;
60*d9f75844SAndroid Build Coastguard Worker ContentGroup& ContentGroup::operator=(const ContentGroup&) = default;
61*d9f75844SAndroid Build Coastguard Worker ContentGroup& ContentGroup::operator=(ContentGroup&&) = default;
62*d9f75844SAndroid Build Coastguard Worker ContentGroup::~ContentGroup() = default;
63*d9f75844SAndroid Build Coastguard Worker 
FirstContentName() const64*d9f75844SAndroid Build Coastguard Worker const std::string* ContentGroup::FirstContentName() const {
65*d9f75844SAndroid Build Coastguard Worker   return (!content_names_.empty()) ? &(*content_names_.begin()) : NULL;
66*d9f75844SAndroid Build Coastguard Worker }
67*d9f75844SAndroid Build Coastguard Worker 
HasContentName(absl::string_view content_name) const68*d9f75844SAndroid Build Coastguard Worker bool ContentGroup::HasContentName(absl::string_view content_name) const {
69*d9f75844SAndroid Build Coastguard Worker   return absl::c_linear_search(content_names_, content_name);
70*d9f75844SAndroid Build Coastguard Worker }
71*d9f75844SAndroid Build Coastguard Worker 
AddContentName(absl::string_view content_name)72*d9f75844SAndroid Build Coastguard Worker void ContentGroup::AddContentName(absl::string_view content_name) {
73*d9f75844SAndroid Build Coastguard Worker   if (!HasContentName(content_name)) {
74*d9f75844SAndroid Build Coastguard Worker     content_names_.emplace_back(content_name);
75*d9f75844SAndroid Build Coastguard Worker   }
76*d9f75844SAndroid Build Coastguard Worker }
77*d9f75844SAndroid Build Coastguard Worker 
RemoveContentName(absl::string_view content_name)78*d9f75844SAndroid Build Coastguard Worker bool ContentGroup::RemoveContentName(absl::string_view content_name) {
79*d9f75844SAndroid Build Coastguard Worker   ContentNames::iterator iter = absl::c_find(content_names_, content_name);
80*d9f75844SAndroid Build Coastguard Worker   if (iter == content_names_.end()) {
81*d9f75844SAndroid Build Coastguard Worker     return false;
82*d9f75844SAndroid Build Coastguard Worker   }
83*d9f75844SAndroid Build Coastguard Worker   content_names_.erase(iter);
84*d9f75844SAndroid Build Coastguard Worker   return true;
85*d9f75844SAndroid Build Coastguard Worker }
86*d9f75844SAndroid Build Coastguard Worker 
ToString() const87*d9f75844SAndroid Build Coastguard Worker std::string ContentGroup::ToString() const {
88*d9f75844SAndroid Build Coastguard Worker   rtc::StringBuilder acc;
89*d9f75844SAndroid Build Coastguard Worker   acc << semantics_ << "(";
90*d9f75844SAndroid Build Coastguard Worker   if (!content_names_.empty()) {
91*d9f75844SAndroid Build Coastguard Worker     for (const auto& name : content_names_) {
92*d9f75844SAndroid Build Coastguard Worker       acc << name << " ";
93*d9f75844SAndroid Build Coastguard Worker     }
94*d9f75844SAndroid Build Coastguard Worker   }
95*d9f75844SAndroid Build Coastguard Worker   acc << ")";
96*d9f75844SAndroid Build Coastguard Worker   return acc.Release();
97*d9f75844SAndroid Build Coastguard Worker }
98*d9f75844SAndroid Build Coastguard Worker 
99*d9f75844SAndroid Build Coastguard Worker SessionDescription::SessionDescription() = default;
100*d9f75844SAndroid Build Coastguard Worker SessionDescription::SessionDescription(const SessionDescription&) = default;
101*d9f75844SAndroid Build Coastguard Worker 
~SessionDescription()102*d9f75844SAndroid Build Coastguard Worker SessionDescription::~SessionDescription() {}
103*d9f75844SAndroid Build Coastguard Worker 
Clone() const104*d9f75844SAndroid Build Coastguard Worker std::unique_ptr<SessionDescription> SessionDescription::Clone() const {
105*d9f75844SAndroid Build Coastguard Worker   // Copy using the private copy constructor.
106*d9f75844SAndroid Build Coastguard Worker   // This will clone the descriptions using ContentInfo's copy constructor.
107*d9f75844SAndroid Build Coastguard Worker   return absl::WrapUnique(new SessionDescription(*this));
108*d9f75844SAndroid Build Coastguard Worker }
109*d9f75844SAndroid Build Coastguard Worker 
GetContentByName(const std::string & name) const110*d9f75844SAndroid Build Coastguard Worker const ContentInfo* SessionDescription::GetContentByName(
111*d9f75844SAndroid Build Coastguard Worker     const std::string& name) const {
112*d9f75844SAndroid Build Coastguard Worker   return FindContentInfoByName(contents_, name);
113*d9f75844SAndroid Build Coastguard Worker }
114*d9f75844SAndroid Build Coastguard Worker 
GetContentByName(const std::string & name)115*d9f75844SAndroid Build Coastguard Worker ContentInfo* SessionDescription::GetContentByName(const std::string& name) {
116*d9f75844SAndroid Build Coastguard Worker   return FindContentInfoByName(&contents_, name);
117*d9f75844SAndroid Build Coastguard Worker }
118*d9f75844SAndroid Build Coastguard Worker 
GetContentDescriptionByName(const std::string & name) const119*d9f75844SAndroid Build Coastguard Worker const MediaContentDescription* SessionDescription::GetContentDescriptionByName(
120*d9f75844SAndroid Build Coastguard Worker     const std::string& name) const {
121*d9f75844SAndroid Build Coastguard Worker   const ContentInfo* cinfo = FindContentInfoByName(contents_, name);
122*d9f75844SAndroid Build Coastguard Worker   if (cinfo == NULL) {
123*d9f75844SAndroid Build Coastguard Worker     return NULL;
124*d9f75844SAndroid Build Coastguard Worker   }
125*d9f75844SAndroid Build Coastguard Worker 
126*d9f75844SAndroid Build Coastguard Worker   return cinfo->media_description();
127*d9f75844SAndroid Build Coastguard Worker }
128*d9f75844SAndroid Build Coastguard Worker 
GetContentDescriptionByName(const std::string & name)129*d9f75844SAndroid Build Coastguard Worker MediaContentDescription* SessionDescription::GetContentDescriptionByName(
130*d9f75844SAndroid Build Coastguard Worker     const std::string& name) {
131*d9f75844SAndroid Build Coastguard Worker   ContentInfo* cinfo = FindContentInfoByName(&contents_, name);
132*d9f75844SAndroid Build Coastguard Worker   if (cinfo == NULL) {
133*d9f75844SAndroid Build Coastguard Worker     return NULL;
134*d9f75844SAndroid Build Coastguard Worker   }
135*d9f75844SAndroid Build Coastguard Worker 
136*d9f75844SAndroid Build Coastguard Worker   return cinfo->media_description();
137*d9f75844SAndroid Build Coastguard Worker }
138*d9f75844SAndroid Build Coastguard Worker 
FirstContentByType(MediaProtocolType type) const139*d9f75844SAndroid Build Coastguard Worker const ContentInfo* SessionDescription::FirstContentByType(
140*d9f75844SAndroid Build Coastguard Worker     MediaProtocolType type) const {
141*d9f75844SAndroid Build Coastguard Worker   return FindContentInfoByType(contents_, type);
142*d9f75844SAndroid Build Coastguard Worker }
143*d9f75844SAndroid Build Coastguard Worker 
FirstContent() const144*d9f75844SAndroid Build Coastguard Worker const ContentInfo* SessionDescription::FirstContent() const {
145*d9f75844SAndroid Build Coastguard Worker   return (contents_.empty()) ? NULL : &(*contents_.begin());
146*d9f75844SAndroid Build Coastguard Worker }
147*d9f75844SAndroid Build Coastguard Worker 
AddContent(const std::string & name,MediaProtocolType type,std::unique_ptr<MediaContentDescription> description)148*d9f75844SAndroid Build Coastguard Worker void SessionDescription::AddContent(
149*d9f75844SAndroid Build Coastguard Worker     const std::string& name,
150*d9f75844SAndroid Build Coastguard Worker     MediaProtocolType type,
151*d9f75844SAndroid Build Coastguard Worker     std::unique_ptr<MediaContentDescription> description) {
152*d9f75844SAndroid Build Coastguard Worker   ContentInfo content(type);
153*d9f75844SAndroid Build Coastguard Worker   content.name = name;
154*d9f75844SAndroid Build Coastguard Worker   content.set_media_description(std::move(description));
155*d9f75844SAndroid Build Coastguard Worker   AddContent(std::move(content));
156*d9f75844SAndroid Build Coastguard Worker }
157*d9f75844SAndroid Build Coastguard Worker 
AddContent(const std::string & name,MediaProtocolType type,bool rejected,std::unique_ptr<MediaContentDescription> description)158*d9f75844SAndroid Build Coastguard Worker void SessionDescription::AddContent(
159*d9f75844SAndroid Build Coastguard Worker     const std::string& name,
160*d9f75844SAndroid Build Coastguard Worker     MediaProtocolType type,
161*d9f75844SAndroid Build Coastguard Worker     bool rejected,
162*d9f75844SAndroid Build Coastguard Worker     std::unique_ptr<MediaContentDescription> description) {
163*d9f75844SAndroid Build Coastguard Worker   ContentInfo content(type);
164*d9f75844SAndroid Build Coastguard Worker   content.name = name;
165*d9f75844SAndroid Build Coastguard Worker   content.rejected = rejected;
166*d9f75844SAndroid Build Coastguard Worker   content.set_media_description(std::move(description));
167*d9f75844SAndroid Build Coastguard Worker   AddContent(std::move(content));
168*d9f75844SAndroid Build Coastguard Worker }
169*d9f75844SAndroid Build Coastguard Worker 
AddContent(const std::string & name,MediaProtocolType type,bool rejected,bool bundle_only,std::unique_ptr<MediaContentDescription> description)170*d9f75844SAndroid Build Coastguard Worker void SessionDescription::AddContent(
171*d9f75844SAndroid Build Coastguard Worker     const std::string& name,
172*d9f75844SAndroid Build Coastguard Worker     MediaProtocolType type,
173*d9f75844SAndroid Build Coastguard Worker     bool rejected,
174*d9f75844SAndroid Build Coastguard Worker     bool bundle_only,
175*d9f75844SAndroid Build Coastguard Worker     std::unique_ptr<MediaContentDescription> description) {
176*d9f75844SAndroid Build Coastguard Worker   ContentInfo content(type);
177*d9f75844SAndroid Build Coastguard Worker   content.name = name;
178*d9f75844SAndroid Build Coastguard Worker   content.rejected = rejected;
179*d9f75844SAndroid Build Coastguard Worker   content.bundle_only = bundle_only;
180*d9f75844SAndroid Build Coastguard Worker   content.set_media_description(std::move(description));
181*d9f75844SAndroid Build Coastguard Worker   AddContent(std::move(content));
182*d9f75844SAndroid Build Coastguard Worker }
183*d9f75844SAndroid Build Coastguard Worker 
AddContent(ContentInfo && content)184*d9f75844SAndroid Build Coastguard Worker void SessionDescription::AddContent(ContentInfo&& content) {
185*d9f75844SAndroid Build Coastguard Worker   if (extmap_allow_mixed()) {
186*d9f75844SAndroid Build Coastguard Worker     // Mixed support on session level overrides setting on media level.
187*d9f75844SAndroid Build Coastguard Worker     content.media_description()->set_extmap_allow_mixed_enum(
188*d9f75844SAndroid Build Coastguard Worker         MediaContentDescription::kSession);
189*d9f75844SAndroid Build Coastguard Worker   }
190*d9f75844SAndroid Build Coastguard Worker   contents_.push_back(std::move(content));
191*d9f75844SAndroid Build Coastguard Worker }
192*d9f75844SAndroid Build Coastguard Worker 
RemoveContentByName(const std::string & name)193*d9f75844SAndroid Build Coastguard Worker bool SessionDescription::RemoveContentByName(const std::string& name) {
194*d9f75844SAndroid Build Coastguard Worker   for (ContentInfos::iterator content = contents_.begin();
195*d9f75844SAndroid Build Coastguard Worker        content != contents_.end(); ++content) {
196*d9f75844SAndroid Build Coastguard Worker     if (content->name == name) {
197*d9f75844SAndroid Build Coastguard Worker       contents_.erase(content);
198*d9f75844SAndroid Build Coastguard Worker       return true;
199*d9f75844SAndroid Build Coastguard Worker     }
200*d9f75844SAndroid Build Coastguard Worker   }
201*d9f75844SAndroid Build Coastguard Worker 
202*d9f75844SAndroid Build Coastguard Worker   return false;
203*d9f75844SAndroid Build Coastguard Worker }
204*d9f75844SAndroid Build Coastguard Worker 
AddTransportInfo(const TransportInfo & transport_info)205*d9f75844SAndroid Build Coastguard Worker void SessionDescription::AddTransportInfo(const TransportInfo& transport_info) {
206*d9f75844SAndroid Build Coastguard Worker   transport_infos_.push_back(transport_info);
207*d9f75844SAndroid Build Coastguard Worker }
208*d9f75844SAndroid Build Coastguard Worker 
RemoveTransportInfoByName(const std::string & name)209*d9f75844SAndroid Build Coastguard Worker bool SessionDescription::RemoveTransportInfoByName(const std::string& name) {
210*d9f75844SAndroid Build Coastguard Worker   for (TransportInfos::iterator transport_info = transport_infos_.begin();
211*d9f75844SAndroid Build Coastguard Worker        transport_info != transport_infos_.end(); ++transport_info) {
212*d9f75844SAndroid Build Coastguard Worker     if (transport_info->content_name == name) {
213*d9f75844SAndroid Build Coastguard Worker       transport_infos_.erase(transport_info);
214*d9f75844SAndroid Build Coastguard Worker       return true;
215*d9f75844SAndroid Build Coastguard Worker     }
216*d9f75844SAndroid Build Coastguard Worker   }
217*d9f75844SAndroid Build Coastguard Worker   return false;
218*d9f75844SAndroid Build Coastguard Worker }
219*d9f75844SAndroid Build Coastguard Worker 
GetTransportInfoByName(const std::string & name) const220*d9f75844SAndroid Build Coastguard Worker const TransportInfo* SessionDescription::GetTransportInfoByName(
221*d9f75844SAndroid Build Coastguard Worker     const std::string& name) const {
222*d9f75844SAndroid Build Coastguard Worker   for (TransportInfos::const_iterator iter = transport_infos_.begin();
223*d9f75844SAndroid Build Coastguard Worker        iter != transport_infos_.end(); ++iter) {
224*d9f75844SAndroid Build Coastguard Worker     if (iter->content_name == name) {
225*d9f75844SAndroid Build Coastguard Worker       return &(*iter);
226*d9f75844SAndroid Build Coastguard Worker     }
227*d9f75844SAndroid Build Coastguard Worker   }
228*d9f75844SAndroid Build Coastguard Worker   return NULL;
229*d9f75844SAndroid Build Coastguard Worker }
230*d9f75844SAndroid Build Coastguard Worker 
GetTransportInfoByName(const std::string & name)231*d9f75844SAndroid Build Coastguard Worker TransportInfo* SessionDescription::GetTransportInfoByName(
232*d9f75844SAndroid Build Coastguard Worker     const std::string& name) {
233*d9f75844SAndroid Build Coastguard Worker   for (TransportInfos::iterator iter = transport_infos_.begin();
234*d9f75844SAndroid Build Coastguard Worker        iter != transport_infos_.end(); ++iter) {
235*d9f75844SAndroid Build Coastguard Worker     if (iter->content_name == name) {
236*d9f75844SAndroid Build Coastguard Worker       return &(*iter);
237*d9f75844SAndroid Build Coastguard Worker     }
238*d9f75844SAndroid Build Coastguard Worker   }
239*d9f75844SAndroid Build Coastguard Worker   return NULL;
240*d9f75844SAndroid Build Coastguard Worker }
241*d9f75844SAndroid Build Coastguard Worker 
RemoveGroupByName(const std::string & name)242*d9f75844SAndroid Build Coastguard Worker void SessionDescription::RemoveGroupByName(const std::string& name) {
243*d9f75844SAndroid Build Coastguard Worker   for (ContentGroups::iterator iter = content_groups_.begin();
244*d9f75844SAndroid Build Coastguard Worker        iter != content_groups_.end(); ++iter) {
245*d9f75844SAndroid Build Coastguard Worker     if (iter->semantics() == name) {
246*d9f75844SAndroid Build Coastguard Worker       content_groups_.erase(iter);
247*d9f75844SAndroid Build Coastguard Worker       break;
248*d9f75844SAndroid Build Coastguard Worker     }
249*d9f75844SAndroid Build Coastguard Worker   }
250*d9f75844SAndroid Build Coastguard Worker }
251*d9f75844SAndroid Build Coastguard Worker 
HasGroup(const std::string & name) const252*d9f75844SAndroid Build Coastguard Worker bool SessionDescription::HasGroup(const std::string& name) const {
253*d9f75844SAndroid Build Coastguard Worker   for (ContentGroups::const_iterator iter = content_groups_.begin();
254*d9f75844SAndroid Build Coastguard Worker        iter != content_groups_.end(); ++iter) {
255*d9f75844SAndroid Build Coastguard Worker     if (iter->semantics() == name) {
256*d9f75844SAndroid Build Coastguard Worker       return true;
257*d9f75844SAndroid Build Coastguard Worker     }
258*d9f75844SAndroid Build Coastguard Worker   }
259*d9f75844SAndroid Build Coastguard Worker   return false;
260*d9f75844SAndroid Build Coastguard Worker }
261*d9f75844SAndroid Build Coastguard Worker 
GetGroupByName(const std::string & name) const262*d9f75844SAndroid Build Coastguard Worker const ContentGroup* SessionDescription::GetGroupByName(
263*d9f75844SAndroid Build Coastguard Worker     const std::string& name) const {
264*d9f75844SAndroid Build Coastguard Worker   for (ContentGroups::const_iterator iter = content_groups_.begin();
265*d9f75844SAndroid Build Coastguard Worker        iter != content_groups_.end(); ++iter) {
266*d9f75844SAndroid Build Coastguard Worker     if (iter->semantics() == name) {
267*d9f75844SAndroid Build Coastguard Worker       return &(*iter);
268*d9f75844SAndroid Build Coastguard Worker     }
269*d9f75844SAndroid Build Coastguard Worker   }
270*d9f75844SAndroid Build Coastguard Worker   return NULL;
271*d9f75844SAndroid Build Coastguard Worker }
272*d9f75844SAndroid Build Coastguard Worker 
GetGroupsByName(const std::string & name) const273*d9f75844SAndroid Build Coastguard Worker std::vector<const ContentGroup*> SessionDescription::GetGroupsByName(
274*d9f75844SAndroid Build Coastguard Worker     const std::string& name) const {
275*d9f75844SAndroid Build Coastguard Worker   std::vector<const ContentGroup*> content_groups;
276*d9f75844SAndroid Build Coastguard Worker   for (const ContentGroup& content_group : content_groups_) {
277*d9f75844SAndroid Build Coastguard Worker     if (content_group.semantics() == name) {
278*d9f75844SAndroid Build Coastguard Worker       content_groups.push_back(&content_group);
279*d9f75844SAndroid Build Coastguard Worker     }
280*d9f75844SAndroid Build Coastguard Worker   }
281*d9f75844SAndroid Build Coastguard Worker   return content_groups;
282*d9f75844SAndroid Build Coastguard Worker }
283*d9f75844SAndroid Build Coastguard Worker 
~ContentInfo()284*d9f75844SAndroid Build Coastguard Worker ContentInfo::~ContentInfo() {
285*d9f75844SAndroid Build Coastguard Worker }
286*d9f75844SAndroid Build Coastguard Worker 
287*d9f75844SAndroid Build Coastguard Worker // Copy operator.
ContentInfo(const ContentInfo & o)288*d9f75844SAndroid Build Coastguard Worker ContentInfo::ContentInfo(const ContentInfo& o)
289*d9f75844SAndroid Build Coastguard Worker     : name(o.name),
290*d9f75844SAndroid Build Coastguard Worker       type(o.type),
291*d9f75844SAndroid Build Coastguard Worker       rejected(o.rejected),
292*d9f75844SAndroid Build Coastguard Worker       bundle_only(o.bundle_only),
293*d9f75844SAndroid Build Coastguard Worker       description_(o.description_->Clone()) {}
294*d9f75844SAndroid Build Coastguard Worker 
operator =(const ContentInfo & o)295*d9f75844SAndroid Build Coastguard Worker ContentInfo& ContentInfo::operator=(const ContentInfo& o) {
296*d9f75844SAndroid Build Coastguard Worker   name = o.name;
297*d9f75844SAndroid Build Coastguard Worker   type = o.type;
298*d9f75844SAndroid Build Coastguard Worker   rejected = o.rejected;
299*d9f75844SAndroid Build Coastguard Worker   bundle_only = o.bundle_only;
300*d9f75844SAndroid Build Coastguard Worker   description_ = o.description_->Clone();
301*d9f75844SAndroid Build Coastguard Worker   return *this;
302*d9f75844SAndroid Build Coastguard Worker }
303*d9f75844SAndroid Build Coastguard Worker 
media_description() const304*d9f75844SAndroid Build Coastguard Worker const MediaContentDescription* ContentInfo::media_description() const {
305*d9f75844SAndroid Build Coastguard Worker   return description_.get();
306*d9f75844SAndroid Build Coastguard Worker }
307*d9f75844SAndroid Build Coastguard Worker 
media_description()308*d9f75844SAndroid Build Coastguard Worker MediaContentDescription* ContentInfo::media_description() {
309*d9f75844SAndroid Build Coastguard Worker   return description_.get();
310*d9f75844SAndroid Build Coastguard Worker }
311*d9f75844SAndroid Build Coastguard Worker 
312*d9f75844SAndroid Build Coastguard Worker }  // namespace cricket
313