webrtc_m130/pc/session_description.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

605 lines
22 KiB
C
Raw Normal View History

/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef PC_SESSION_DESCRIPTION_H_
#define PC_SESSION_DESCRIPTION_H_
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
#include "api/media_types.h"
#include "api/rtp_parameters.h"
#include "api/rtp_transceiver_direction.h"
#include "api/rtp_transceiver_interface.h"
#include "media/base/codec.h"
#include "media/base/media_channel.h"
Reland "sdp: parse and serialize b=TIAS" This reverts commit 20b701f3d79c499b0981f03fbf3a9b0fe531ac5d. Reason for reland: Reverting did not affect the test regression. Original change's description: > Revert "sdp: parse and serialize b=TIAS" > > This reverts commit c6801d4522ab94f965e258e68259fde312023654. > > Reason for revert: Speculatively reverting since it possibly breaks downstream performance test. > > One issue I noticed is that the correct SDP won't be produced if set_bandwidth_type hasn't been called. Probably should default to b=AS in that case. > > Original change's description: > > sdp: parse and serialize b=TIAS > > > > BUG=webrtc:5788 > > > > Change-Id: I063c756004e4c224fffa36d2800603c7b7e50dce > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179223 > > Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com> > > Reviewed-by: Taylor <deadbeef@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#31729} > > TBR=deadbeef@webrtc.org,hta@webrtc.org,minyue@webrtc.org,philipp.hancke@googlemail.com,jleconte@webrtc.org > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: webrtc:5788 > Change-Id: I2a3f676b4359834e511dffd5adedc9388e0ea0f8 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179620 > Reviewed-by: Taylor <deadbeef@webrtc.org> > Commit-Queue: Taylor <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31762} TBR=nisse@webrtc.org Bug: webrtc:5788 Change-Id: I5c0ef29d275bb2264d9b706b085f7933d59e2801 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179760 Commit-Queue: Taylor <deadbeef@webrtc.org> Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31816}
2020-07-27 15:52:02 -07:00
#include "media/base/media_constants.h"
#include "media/base/rid_description.h"
#include "media/base/stream_params.h"
#include "p2p/base/transport_description.h"
#include "p2p/base/transport_info.h"
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
#include "pc/media_protocol_names.h"
#include "pc/simulcast_description.h"
#include "rtc_base/checks.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/system/rtc_export.h"
namespace cricket {
using RtpHeaderExtensions = std::vector<webrtc::RtpExtension>;
// Options to control how session descriptions are generated.
const int kAutoBandwidth = -1;
class AudioContentDescription;
Revert "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. Reason for revert: fuzzer failures Original change's description: > Reland "Version 2 "Refactoring DataContentDescription class"" > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > Original change's description: > > Version 2 "Refactoring DataContentDescription class" > > > > (substantial changes since version 1) > > > > This CL splits the cricket::DataContentDescription class into > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > SctpDataContentDescription no longer inherits from > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > Due to usage of internal interfaces by consumers, shimming the old > > DataContentDescription API is needed. > > > > A new cricket::DataContentDescription class is defined, which is > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > It exposes as little functionality as possible, but supports the > > concerned consumer's usage > > > > Design document: > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > > Bug: webrtc:10358 > > Change-Id: Icf95fb7308244d6f2ebfdb403aaffc544e358580 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133900 > > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#27853} > > Bug: webrtc:10358 > Change-Id: Iff45c4694167f0b31b34ff2167c1f4ffa650bcc4 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135281 > Reviewed-by: Steve Anton <steveanton@webrtc.org> > Commit-Queue: Harald Alvestrand <hta@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#27896} TBR=steveanton@webrtc.org,kwiberg@webrtc.org,hbos@webrtc.org,hta@webrtc.org,shampson@webrtc.org Change-Id: Ied6d9fb96aafe9c957f2658b34b5331b1f359b26 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:10358 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135986 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27917}
2019-05-10 11:15:18 -07:00
class VideoContentDescription;
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
class SctpDataContentDescription;
class UnsupportedContentDescription;
// Describes a session description media section. There are subclasses for each
// media type (audio, video, data) that will have additional information.
class MediaContentDescription {
public:
MediaContentDescription() = default;
virtual ~MediaContentDescription() = default;
virtual MediaType type() const = 0;
// Try to cast this media description to an AudioContentDescription. Returns
// nullptr if the cast fails.
virtual AudioContentDescription* as_audio() { return nullptr; }
virtual const AudioContentDescription* as_audio() const { return nullptr; }
// Try to cast this media description to a VideoContentDescription. Returns
// nullptr if the cast fails.
virtual VideoContentDescription* as_video() { return nullptr; }
virtual const VideoContentDescription* as_video() const { return nullptr; }
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
virtual SctpDataContentDescription* as_sctp() { return nullptr; }
virtual const SctpDataContentDescription* as_sctp() const { return nullptr; }
virtual UnsupportedContentDescription* as_unsupported() { return nullptr; }
virtual const UnsupportedContentDescription* as_unsupported() const {
return nullptr;
}
// Copy operator that returns an unique_ptr.
// Not a virtual function.
// If a type-specific variant of Clone() is desired, override it, or
// simply use std::make_unique<typename>(*this) instead of Clone().
std::unique_ptr<MediaContentDescription> Clone() const {
return absl::WrapUnique(CloneInternal());
}
Reland "Use backticks not vertical bars to denote variables in comments for /pc" Original change's description: > Revert "Use backticks not vertical bars to denote variables in comments for /pc" > > This reverts commit 37ee0f5e594dd772ec6d620b5e5ea8a751b684f0. > > Reason for revert: Revert in order to be able to revert https://webrtc-review.googlesource.com/c/src/+/225642 > > Original change's description: > > Use backticks not vertical bars to denote variables in comments for /pc > > > > Bug: webrtc:12338 > > Change-Id: I88cf10afa5fc810b95d2a585ab2e895dcc163b63 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226953 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Artem Titov <titovartem@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34575} > > TBR=hta@webrtc.org,titovartem@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I5eddd3a14e1f664bf831e5c294fbc4de5f6a88af > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12338 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227082 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Commit-Queue: Björn Terelius <terelius@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34577} Bug: webrtc:12338 Change-Id: I96bd229b73613c162d11d75fa4f5934e1b4295c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227087 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34611}
2021-07-30 22:30:23 +02:00
// `protocol` is the expected media transport protocol, such as RTP/AVPF,
// RTP/SAVPF or SCTP/DTLS.
std::string protocol() const { return protocol_; }
virtual void set_protocol(absl::string_view protocol) {
protocol_ = std::string(protocol);
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
}
webrtc::RtpTransceiverDirection direction() const { return direction_; }
void set_direction(webrtc::RtpTransceiverDirection direction) {
direction_ = direction;
}
bool rtcp_mux() const { return rtcp_mux_; }
void set_rtcp_mux(bool mux) { rtcp_mux_ = mux; }
bool rtcp_reduced_size() const { return rtcp_reduced_size_; }
void set_rtcp_reduced_size(bool reduced_size) {
rtcp_reduced_size_ = reduced_size;
}
// Indicates support for the remote network estimate packet type. This
// functionality is experimental and subject to change without notice.
bool remote_estimate() const { return remote_estimate_; }
void set_remote_estimate(bool remote_estimate) {
remote_estimate_ = remote_estimate;
}
// Support of RFC 8888 feedback messages.
// This is a transport-wide property, but is signalled in SDP
// at the m-line level; its mux category is IDENTICAL-PER-PT,
// and only wildcard is allowed. RFC 8888 section 6.
bool rtcp_fb_ack_ccfb() const { return rtcp_fb_ack_ccfb_; }
void set_rtcp_fb_ack_ccfb(bool enable) { rtcp_fb_ack_ccfb_ = enable; }
int bandwidth() const { return bandwidth_; }
void set_bandwidth(int bandwidth) { bandwidth_ = bandwidth; }
std::string bandwidth_type() const { return bandwidth_type_; }
void set_bandwidth_type(std::string bandwidth_type) {
Reland "sdp: parse and serialize b=TIAS" This reverts commit 20b701f3d79c499b0981f03fbf3a9b0fe531ac5d. Reason for reland: Reverting did not affect the test regression. Original change's description: > Revert "sdp: parse and serialize b=TIAS" > > This reverts commit c6801d4522ab94f965e258e68259fde312023654. > > Reason for revert: Speculatively reverting since it possibly breaks downstream performance test. > > One issue I noticed is that the correct SDP won't be produced if set_bandwidth_type hasn't been called. Probably should default to b=AS in that case. > > Original change's description: > > sdp: parse and serialize b=TIAS > > > > BUG=webrtc:5788 > > > > Change-Id: I063c756004e4c224fffa36d2800603c7b7e50dce > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179223 > > Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com> > > Reviewed-by: Taylor <deadbeef@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#31729} > > TBR=deadbeef@webrtc.org,hta@webrtc.org,minyue@webrtc.org,philipp.hancke@googlemail.com,jleconte@webrtc.org > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: webrtc:5788 > Change-Id: I2a3f676b4359834e511dffd5adedc9388e0ea0f8 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179620 > Reviewed-by: Taylor <deadbeef@webrtc.org> > Commit-Queue: Taylor <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31762} TBR=nisse@webrtc.org Bug: webrtc:5788 Change-Id: I5c0ef29d275bb2264d9b706b085f7933d59e2801 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179760 Commit-Queue: Taylor <deadbeef@webrtc.org> Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31816}
2020-07-27 15:52:02 -07:00
bandwidth_type_ = bandwidth_type;
}
// List of RTP header extensions. URIs are **NOT** guaranteed to be unique
// as they can appear twice when both encrypted and non-encrypted extensions
// are present.
// Use RtpExtension::FindHeaderExtensionByUri for finding and
// RtpExtension::DeduplicateHeaderExtensions for filtering.
const RtpHeaderExtensions& rtp_header_extensions() const {
return rtp_header_extensions_;
}
void set_rtp_header_extensions(const RtpHeaderExtensions& extensions) {
rtp_header_extensions_ = extensions;
rtp_header_extensions_set_ = true;
}
void AddRtpHeaderExtension(const webrtc::RtpExtension& ext) {
rtp_header_extensions_.push_back(ext);
rtp_header_extensions_set_ = true;
}
void ClearRtpHeaderExtensions() {
rtp_header_extensions_.clear();
rtp_header_extensions_set_ = true;
}
// We can't always tell if an empty list of header extensions is
// because the other side doesn't support them, or just isn't hooked up to
// signal them. For now we assume an empty list means no signaling, but
// provide the ClearRtpHeaderExtensions method to allow "no support" to be
// clearly indicated (i.e. when derived from other information).
bool rtp_header_extensions_set() const { return rtp_header_extensions_set_; }
const StreamParamsVec& streams() const { return send_streams_; }
// TODO(pthatcher): Remove this by giving mediamessage.cc access
// to MediaContentDescription
StreamParamsVec& mutable_streams() { return send_streams_; }
void AddStream(const StreamParams& stream) {
send_streams_.push_back(stream);
}
// Legacy streams have an ssrc, but nothing else.
void AddLegacyStream(uint32_t ssrc) {
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
AddStream(StreamParams::CreateLegacy(ssrc));
}
void AddLegacyStream(uint32_t ssrc, uint32_t fid_ssrc) {
StreamParams sp = StreamParams::CreateLegacy(ssrc);
sp.AddFidSsrc(ssrc, fid_ssrc);
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
AddStream(sp);
}
uint32_t first_ssrc() const {
if (send_streams_.empty()) {
return 0;
}
return send_streams_[0].first_ssrc();
}
bool has_ssrcs() const {
if (send_streams_.empty()) {
return false;
}
return send_streams_[0].has_ssrcs();
}
void set_conference_mode(bool enable) { conference_mode_ = enable; }
bool conference_mode() const { return conference_mode_; }
// https://tools.ietf.org/html/rfc4566#section-5.7
// May be present at the media or session level of SDP. If present at both
// levels, the media-level attribute overwrites the session-level one.
void set_connection_address(const rtc::SocketAddress& address) {
connection_address_ = address;
}
const rtc::SocketAddress& connection_address() const {
return connection_address_;
}
// Determines if it's allowed to mix one- and two-byte rtp header extensions
// within the same rtp stream.
enum ExtmapAllowMixed { kNo, kSession, kMedia };
void set_extmap_allow_mixed_enum(ExtmapAllowMixed new_extmap_allow_mixed) {
if (new_extmap_allow_mixed == kMedia &&
extmap_allow_mixed_enum_ == kSession) {
// Do not downgrade from session level to media level.
return;
}
extmap_allow_mixed_enum_ = new_extmap_allow_mixed;
}
ExtmapAllowMixed extmap_allow_mixed_enum() const {
return extmap_allow_mixed_enum_;
}
bool extmap_allow_mixed() const { return extmap_allow_mixed_enum_ != kNo; }
// Simulcast functionality.
bool HasSimulcast() const { return !simulcast_.empty(); }
SimulcastDescription& simulcast_description() { return simulcast_; }
const SimulcastDescription& simulcast_description() const {
return simulcast_;
}
void set_simulcast_description(const SimulcastDescription& simulcast) {
simulcast_ = simulcast;
}
const std::vector<RidDescription>& receive_rids() const {
return receive_rids_;
}
void set_receive_rids(const std::vector<RidDescription>& rids) {
receive_rids_ = rids;
}
// Codecs should be in preference order (most preferred codec first).
const std::vector<Codec>& codecs() const { return codecs_; }
void set_codecs(const std::vector<Codec>& codecs) { codecs_ = codecs; }
virtual bool has_codecs() const { return !codecs_.empty(); }
bool HasCodec(int id) {
return absl::c_find_if(codecs_, [id](const cricket::Codec codec) {
return codec.id == id;
}) != codecs_.end();
}
void AddCodec(const Codec& codec) { codecs_.push_back(codec); }
void AddOrReplaceCodec(const Codec& codec) {
for (auto it = codecs_.begin(); it != codecs_.end(); ++it) {
if (it->id == codec.id) {
*it = codec;
return;
}
}
AddCodec(codec);
}
void AddCodecs(const std::vector<Codec>& codecs) {
for (const auto& codec : codecs) {
AddCodec(codec);
}
}
protected:
// TODO(bugs.webrtc.org/15214): move all RTP related things to
// RtpMediaDescription that the SCTP content description does
// not inherit from.
std::string protocol_;
private:
bool rtcp_mux_ = false;
bool rtcp_reduced_size_ = false;
bool remote_estimate_ = false;
bool rtcp_fb_ack_ccfb_ = false;
int bandwidth_ = kAutoBandwidth;
Reland "sdp: parse and serialize b=TIAS" This reverts commit 20b701f3d79c499b0981f03fbf3a9b0fe531ac5d. Reason for reland: Reverting did not affect the test regression. Original change's description: > Revert "sdp: parse and serialize b=TIAS" > > This reverts commit c6801d4522ab94f965e258e68259fde312023654. > > Reason for revert: Speculatively reverting since it possibly breaks downstream performance test. > > One issue I noticed is that the correct SDP won't be produced if set_bandwidth_type hasn't been called. Probably should default to b=AS in that case. > > Original change's description: > > sdp: parse and serialize b=TIAS > > > > BUG=webrtc:5788 > > > > Change-Id: I063c756004e4c224fffa36d2800603c7b7e50dce > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179223 > > Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com> > > Reviewed-by: Taylor <deadbeef@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#31729} > > TBR=deadbeef@webrtc.org,hta@webrtc.org,minyue@webrtc.org,philipp.hancke@googlemail.com,jleconte@webrtc.org > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: webrtc:5788 > Change-Id: I2a3f676b4359834e511dffd5adedc9388e0ea0f8 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179620 > Reviewed-by: Taylor <deadbeef@webrtc.org> > Commit-Queue: Taylor <deadbeef@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#31762} TBR=nisse@webrtc.org Bug: webrtc:5788 Change-Id: I5c0ef29d275bb2264d9b706b085f7933d59e2801 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179760 Commit-Queue: Taylor <deadbeef@webrtc.org> Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31816}
2020-07-27 15:52:02 -07:00
std::string bandwidth_type_ = kApplicationSpecificBandwidth;
std::vector<webrtc::RtpExtension> rtp_header_extensions_;
bool rtp_header_extensions_set_ = false;
StreamParamsVec send_streams_;
bool conference_mode_ = false;
webrtc::RtpTransceiverDirection direction_ =
webrtc::RtpTransceiverDirection::kSendRecv;
rtc::SocketAddress connection_address_;
ExtmapAllowMixed extmap_allow_mixed_enum_ = kMedia;
SimulcastDescription simulcast_;
std::vector<RidDescription> receive_rids_;
Add an alt-protocol to SDP to indicate which m= sections use a plugin transport. The plugin transport parameters (a=x-opaque: lines) relate to how to create and set up a plugin transport. When SDP bundle is used, the x-opaque line needs to be copied into the bundled m= section. This means x-opaque can appear on a section even if the offerer does not intend to use the transport for the media described by that section. Consequently, the answerer cannot currently tell whether the caller is offering an alternate transport for media, data, or both. This change adds an a=x-alt-protocol: line to SDP. The value following this line matches the <protocol> part of the x-opaque:<protocol>:<params> line. However, alt-protocol is not bundled--it only ever applies to the m= section that contains the line. This allows the offerer to express which m= sections should actually use an alternate transport, even in the case of bundle. Note that this is still limited by the available configuration options: datagram transport can be used for media (audio + video) and/or data. It is still not possible to use it for audio but not video, or vice versa. PeerConnection places an alt-protocol line in each media (audio/video) m= section if it is configured to use a datagram transport for media. It places an alt-protocol line in each data m= section if it is configured to use a datagram transport for data channels. PeerConnection leaves alt-protocol in media (audio/video) m= sections of the answer if it is configured to use a datagram transport for media, and in data m= sections of the answer if it is configured to use a datagram transport for data channels. JsepTransport now negotiates use of the datagram transport independently for media and data channels. It only uses it for media if the m= sections for bundled audio/video have an alt-protocol line matching the x-opaque protocol, and only uses it for data channels if a bundled m= section for data has an alt-protocol line matching the x-opaque protocol. Bug: webrtc:9719 Change-Id: I773e4fc10c57d815afcd76a2a74da38dd0c52b3b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154763 Reviewed-by: Steve Anton <steveanton@webrtc.org> Reviewed-by: Seth Hampson <shampson@webrtc.org> Commit-Queue: Bjorn Mellem <mellem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29351}
2019-09-30 15:12:47 -07:00
// Copy function that returns a raw pointer. Caller will assert ownership.
// Should only be called by the Clone() function. Must be implemented
// by each final subclass.
virtual MediaContentDescription* CloneInternal() const = 0;
std::vector<Codec> codecs_;
};
class RtpMediaContentDescription : public MediaContentDescription {};
class AudioContentDescription : public RtpMediaContentDescription {
public:
void set_protocol(absl::string_view protocol) override {
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
RTC_DCHECK(IsRtpProtocol(protocol));
protocol_ = std::string(protocol);
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
}
MediaType type() const override { return MEDIA_TYPE_AUDIO; }
AudioContentDescription* as_audio() override { return this; }
const AudioContentDescription* as_audio() const override { return this; }
private:
AudioContentDescription* CloneInternal() const override {
return new AudioContentDescription(*this);
}
};
class VideoContentDescription : public RtpMediaContentDescription {
public:
void set_protocol(absl::string_view protocol) override {
RTC_DCHECK(IsRtpProtocol(protocol));
protocol_ = std::string(protocol);
}
MediaType type() const override { return MEDIA_TYPE_VIDEO; }
VideoContentDescription* as_video() override { return this; }
const VideoContentDescription* as_video() const override { return this; }
private:
VideoContentDescription* CloneInternal() const override {
return new VideoContentDescription(*this);
}
};
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
class SctpDataContentDescription : public MediaContentDescription {
public:
SctpDataContentDescription() {}
SctpDataContentDescription(const SctpDataContentDescription& o)
: MediaContentDescription(o),
use_sctpmap_(o.use_sctpmap_),
port_(o.port_),
max_message_size_(o.max_message_size_) {}
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
MediaType type() const override { return MEDIA_TYPE_DATA; }
SctpDataContentDescription* as_sctp() override { return this; }
const SctpDataContentDescription* as_sctp() const override { return this; }
bool has_codecs() const override { return false; }
void set_protocol(absl::string_view protocol) override {
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
RTC_DCHECK(IsSctpProtocol(protocol));
protocol_ = std::string(protocol);
}
bool use_sctpmap() const { return use_sctpmap_; }
void set_use_sctpmap(bool enable) { use_sctpmap_ = enable; }
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
int port() const { return port_; }
void set_port(int port) { port_ = port; }
int max_message_size() const { return max_message_size_; }
void set_max_message_size(int max_message_size) {
max_message_size_ = max_message_size;
}
private:
SctpDataContentDescription* CloneInternal() const override {
return new SctpDataContentDescription(*this);
}
Reland "Reland "Version 2 "Refactoring DataContentDescription class""" This reverts commit 46afbf9481fbcc939c998c898ca1031ce41cc6b1. Reason for revert: Tightened protocol name handling. Original change's description: > Revert "Reland "Version 2 "Refactoring DataContentDescription class""" > > This reverts commit 37f2b43274a0d718de53a4cfcf02226356edcf6e. > > Reason for revert: fuzzer failures > > Original change's description: > > Reland "Version 2 "Refactoring DataContentDescription class"" > > > > This is a reland of 14b2758726879d21671a21291dfed8fb4fd5c21c > > > > Original change's description: > > > Version 2 "Refactoring DataContentDescription class" > > > > > > (substantial changes since version 1) > > > > > > This CL splits the cricket::DataContentDescription class into > > > two classes: cricket::RtpDataContentDescription (used for RTP data) > > > and cricket::SctpDataContentDescription (used for SCTP only). > > > > > > SctpDataContentDescription no longer inherits from > > > MediaContentDescriptionImpl, and no longer contains "codecs". > > > > > > Due to usage of internal interfaces by consumers, shimming the old > > > DataContentDescription API is needed. > > > > > > A new cricket::DataContentDescription class is defined, which is > > > a shim over RtpDataContentDescription and SctpDataContentDescription. > > > It exposes as little functionality as possible, but supports the > > > concerned consumer's usage > > > > > > Design document: > > > https://docs.google.com/document/d/1H5LfQxJA2ikMWTQ8FZ3_GAmaXM7knfVQWiSz6ph8VQ0/edit# > > > > > > Version 1 reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132700 > > > Bug: webrtc:10358 Change-Id: Ia9fb8f4679e082e3d18fbbb6b03fc13a08e06110 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136581 Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27933}
2019-05-13 13:36:16 +02:00
bool use_sctpmap_ = true; // Note: "true" is no longer conformant.
// Defaults should be constants imported from SCTP. Quick hack.
int port_ = 5000;
// draft-ietf-mmusic-sdp-sctp-23: Max message size default is 64K
int max_message_size_ = 64 * 1024;
};
class UnsupportedContentDescription : public MediaContentDescription {
public:
explicit UnsupportedContentDescription(absl::string_view media_type)
: media_type_(media_type) {}
MediaType type() const override { return MEDIA_TYPE_UNSUPPORTED; }
UnsupportedContentDescription* as_unsupported() override { return this; }
const UnsupportedContentDescription* as_unsupported() const override {
return this;
}
bool has_codecs() const override { return false; }
const std::string& media_type() const { return media_type_; }
private:
UnsupportedContentDescription* CloneInternal() const override {
return new UnsupportedContentDescription(*this);
}
std::string media_type_;
};
// Protocol used for encoding media. This is the "top level" protocol that may
// be wrapped by zero or many transport protocols (UDP, ICE, etc.).
enum class MediaProtocolType {
kRtp, // Section will use the RTP protocol (e.g., for audio or video).
// https://tools.ietf.org/html/rfc3550
kSctp, // Section will use the SCTP protocol (e.g., for a data channel).
// https://tools.ietf.org/html/rfc4960
kOther // Section will use another top protocol which is not
// explicitly supported.
};
// Represents a session description section. Most information about the section
// is stored in the description, which is a subclass of MediaContentDescription.
// Owns the description.
class RTC_EXPORT ContentInfo {
public:
explicit ContentInfo(MediaProtocolType type) : type(type) {}
ContentInfo(MediaProtocolType type,
absl::string_view mid,
std::unique_ptr<MediaContentDescription> description,
bool rejected = false,
bool bundle_only = false)
: type(type),
rejected(rejected),
bundle_only(bundle_only),
mid_(mid),
description_(std::move(description)) {}
~ContentInfo();
// Copy ctor and assignment will clone `description_`.
ContentInfo(const ContentInfo& o);
// Const ref assignment operator removed. Instead, use the explicit ctor.
ContentInfo& operator=(const ContentInfo& o) = delete;
ContentInfo(ContentInfo&& o) = default;
ContentInfo& operator=(ContentInfo&& o) = default;
// TODO(tommi): change return type to string_view.
const std::string& mid() const { return mid_; }
void set_mid(absl::string_view mid) { mid_ = std::string(mid); }
Reland "Use backticks not vertical bars to denote variables in comments for /pc" Original change's description: > Revert "Use backticks not vertical bars to denote variables in comments for /pc" > > This reverts commit 37ee0f5e594dd772ec6d620b5e5ea8a751b684f0. > > Reason for revert: Revert in order to be able to revert https://webrtc-review.googlesource.com/c/src/+/225642 > > Original change's description: > > Use backticks not vertical bars to denote variables in comments for /pc > > > > Bug: webrtc:12338 > > Change-Id: I88cf10afa5fc810b95d2a585ab2e895dcc163b63 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226953 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Artem Titov <titovartem@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34575} > > TBR=hta@webrtc.org,titovartem@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I5eddd3a14e1f664bf831e5c294fbc4de5f6a88af > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12338 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227082 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Commit-Queue: Björn Terelius <terelius@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34577} Bug: webrtc:12338 Change-Id: I96bd229b73613c162d11d75fa4f5934e1b4295c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227087 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34611}
2021-07-30 22:30:23 +02:00
// Alias for `description`.
MediaContentDescription* media_description();
const MediaContentDescription* media_description() const;
MediaProtocolType type;
bool rejected = false;
bool bundle_only = false;
private:
std::string mid_;
friend class SessionDescription;
std::unique_ptr<MediaContentDescription> description_;
};
typedef std::vector<std::string> ContentNames;
// This class provides a mechanism to aggregate different media contents into a
// group. This group can also be shared with the peers in a pre-defined format.
Reland "Use backticks not vertical bars to denote variables in comments for /pc" Original change's description: > Revert "Use backticks not vertical bars to denote variables in comments for /pc" > > This reverts commit 37ee0f5e594dd772ec6d620b5e5ea8a751b684f0. > > Reason for revert: Revert in order to be able to revert https://webrtc-review.googlesource.com/c/src/+/225642 > > Original change's description: > > Use backticks not vertical bars to denote variables in comments for /pc > > > > Bug: webrtc:12338 > > Change-Id: I88cf10afa5fc810b95d2a585ab2e895dcc163b63 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226953 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Artem Titov <titovartem@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34575} > > TBR=hta@webrtc.org,titovartem@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I5eddd3a14e1f664bf831e5c294fbc4de5f6a88af > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12338 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227082 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Commit-Queue: Björn Terelius <terelius@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34577} Bug: webrtc:12338 Change-Id: I96bd229b73613c162d11d75fa4f5934e1b4295c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227087 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34611}
2021-07-30 22:30:23 +02:00
// GroupInfo should be populated only with the `content_name` of the
// MediaDescription.
class ContentGroup {
public:
explicit ContentGroup(const std::string& semantics);
ContentGroup(const ContentGroup&);
ContentGroup(ContentGroup&&);
ContentGroup& operator=(const ContentGroup&);
ContentGroup& operator=(ContentGroup&&);
~ContentGroup();
const std::string& semantics() const { return semantics_; }
const ContentNames& content_names() const { return content_names_; }
const std::string* FirstContentName() const;
bool HasContentName(absl::string_view content_name) const;
void AddContentName(absl::string_view content_name);
bool RemoveContentName(absl::string_view content_name);
// for debugging
std::string ToString() const;
private:
std::string semantics_;
ContentNames content_names_;
};
typedef std::vector<ContentInfo> ContentInfos;
typedef std::vector<ContentGroup> ContentGroups;
// Determines how the MSID will be signaled in the SDP.
// These can be used as bit flags to indicate both or the special value none.
enum MsidSignaling {
// MSID is not signaled. This is not a bit flag and must be compared for
// equality.
kMsidSignalingNotUsed = 0x0,
// Signal MSID with at least one a=msid line in the media section.
// This requires unified plan.
kMsidSignalingMediaSection = 0x1,
// Signal MSID with a=ssrc: msid lines in the media section.
// This should only be used with plan-b but is signalled in
// offers for backward compability reasons.
kMsidSignalingSsrcAttribute = 0x2,
// Signal MSID with a=msid-semantic: WMS in the session section.
// This is deprecated but signalled for backward compability reasons.
// It is typically combined with 0x1 or 0x2.
kMsidSignalingSemantic = 0x4
};
// Describes a collection of contents, each with its own name and
// type. Analogous to a <jingle> or <session> stanza. Assumes that
// contents are unique be name, but doesn't enforce that.
class SessionDescription {
public:
SessionDescription();
~SessionDescription();
std::unique_ptr<SessionDescription> Clone() const;
// Content accessors.
const ContentInfos& contents() const { return contents_; }
ContentInfos& contents() { return contents_; }
const ContentInfo* GetContentByName(const std::string& name) const;
ContentInfo* GetContentByName(const std::string& name);
const MediaContentDescription* GetContentDescriptionByName(
absl::string_view name) const;
MediaContentDescription* GetContentDescriptionByName(absl::string_view name);
const ContentInfo* FirstContentByType(MediaProtocolType type) const;
const ContentInfo* FirstContent() const;
// Content mutators.
// Adds a content to this description. Takes ownership of ContentDescription*.
void AddContent(const std::string& name,
MediaProtocolType type,
std::unique_ptr<MediaContentDescription> description);
void AddContent(const std::string& name,
MediaProtocolType type,
bool rejected,
std::unique_ptr<MediaContentDescription> description);
void AddContent(const std::string& name,
MediaProtocolType type,
bool rejected,
bool bundle_only,
std::unique_ptr<MediaContentDescription> description);
void AddContent(ContentInfo&& content);
bool RemoveContentByName(const std::string& name);
// Transport accessors.
const TransportInfos& transport_infos() const { return transport_infos_; }
TransportInfos& transport_infos() { return transport_infos_; }
const TransportInfo* GetTransportInfoByName(const std::string& name) const;
TransportInfo* GetTransportInfoByName(const std::string& name);
const TransportDescription* GetTransportDescriptionByName(
const std::string& name) const {
const TransportInfo* tinfo = GetTransportInfoByName(name);
return tinfo ? &tinfo->description : NULL;
}
// Transport mutators.
void set_transport_infos(const TransportInfos& transport_infos) {
transport_infos_ = transport_infos;
}
// Adds a TransportInfo to this description.
void AddTransportInfo(const TransportInfo& transport_info);
bool RemoveTransportInfoByName(const std::string& name);
// Group accessors.
const ContentGroups& groups() const { return content_groups_; }
const ContentGroup* GetGroupByName(const std::string& name) const;
[Unified Plan] Support multiple BUNDLE groups. In this CL, JsepTransportController and MediaSessionDescriptionFactory are updated not to assume that there only exists at most a single BUNDLE group but a list of N groups. This makes it possible to create multiple BUNDLE groups by having multiple "a=group:BUNDLE" lines in the SDP. This makes it possible to have some m= sections in one group and some other m= sections in another group. For example, you could group all audio m= sections in one group and all video m= sections in another group. This enables "send all audio tracks on one transport and all video tracks on another transport" in Unified Plan. This is something that was possible in Plan B because all ssrcs in the same m= section were implicitly bundled together forming a group of audio m= section and video m= section (even without use of the BUNDLE tag). PeerConnection will never create multiple BUNDLE groups by default, but upon setting SDP with multiple BUNDLE groups the PeerConnection will accept them if configured to accept BUNDLE. This makes it possible to accept an SFU's BUNDLE offer without having to SDP munge the answer. C++ unit tests are added. This fix has also been verified manually on: https://jsfiddle.net/henbos/to89L6ce/43/ Without fix: 0+2 get bundled, 1+3 don't get bundled. With fix: 0+2 get bundled in first group, 1+3 get bundled in second group. Bug: webrtc:10208 Change-Id: Iaf451fa5459c484730c8018274166ef154b19af8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214487 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33838}
2021-04-26 21:04:26 +02:00
std::vector<const ContentGroup*> GetGroupsByName(
const std::string& name) const;
bool HasGroup(const std::string& name) const;
// Group mutators.
void AddGroup(const ContentGroup& group) { content_groups_.push_back(group); }
Reland "Use backticks not vertical bars to denote variables in comments for /pc" Original change's description: > Revert "Use backticks not vertical bars to denote variables in comments for /pc" > > This reverts commit 37ee0f5e594dd772ec6d620b5e5ea8a751b684f0. > > Reason for revert: Revert in order to be able to revert https://webrtc-review.googlesource.com/c/src/+/225642 > > Original change's description: > > Use backticks not vertical bars to denote variables in comments for /pc > > > > Bug: webrtc:12338 > > Change-Id: I88cf10afa5fc810b95d2a585ab2e895dcc163b63 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226953 > > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > > Commit-Queue: Artem Titov <titovartem@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#34575} > > TBR=hta@webrtc.org,titovartem@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com > > Change-Id: I5eddd3a14e1f664bf831e5c294fbc4de5f6a88af > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:12338 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227082 > Reviewed-by: Björn Terelius <terelius@webrtc.org> > Commit-Queue: Björn Terelius <terelius@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#34577} Bug: webrtc:12338 Change-Id: I96bd229b73613c162d11d75fa4f5934e1b4295c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227087 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34611}
2021-07-30 22:30:23 +02:00
// Remove the first group with the same semantics specified by `name`.
void RemoveGroupByName(const std::string& name);
// Global attributes.
// Determines how the MSIDs were/will be signaled. Flag value composed of
// MsidSignaling bits (see enum above).
void set_msid_signaling(int msid_signaling) {
msid_signaling_ = msid_signaling;
}
int msid_signaling() const { return msid_signaling_; }
// Determines if it's allowed to mix one- and two-byte rtp header extensions
// within the same rtp stream.
void set_extmap_allow_mixed(bool supported) {
extmap_allow_mixed_ = supported;
MediaContentDescription::ExtmapAllowMixed media_level_setting =
supported ? MediaContentDescription::kSession
: MediaContentDescription::kNo;
for (auto& content : contents_) {
// Do not set to kNo if the current setting is kMedia.
if (supported || content.media_description()->extmap_allow_mixed_enum() !=
MediaContentDescription::kMedia) {
content.media_description()->set_extmap_allow_mixed_enum(
media_level_setting);
}
}
}
bool extmap_allow_mixed() const { return extmap_allow_mixed_; }
private:
SessionDescription(const SessionDescription&);
ContentInfos contents_;
TransportInfos transport_infos_;
ContentGroups content_groups_;
int msid_signaling_ = kMsidSignalingMediaSection | kMsidSignalingSemantic;
bool extmap_allow_mixed_ = true;
};
// Indicates whether a session description was sent by the local client or
// received from the remote client.
enum ContentSource { CS_LOCAL, CS_REMOTE };
} // namespace cricket
#endif // PC_SESSION_DESCRIPTION_H_