2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-12 00:05:01 -08:00
|
|
|
* Copyright 2004 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-12 00:05:01 -08:00
|
|
|
* 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.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Types and classes used in media session descriptions.
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#ifndef PC_MEDIA_SESSION_H_
|
|
|
|
|
#define PC_MEDIA_SESSION_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-02-23 17:24:52 -08:00
|
|
|
#include <map>
|
2018-12-10 17:18:54 -08:00
|
|
|
#include <memory>
|
2013-07-10 00:45:36 +00:00
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2021-01-29 14:45:08 +00:00
|
|
|
#include "api/crypto/crypto_options.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/media_types.h"
|
2021-01-29 14:45:08 +00:00
|
|
|
#include "api/rtp_parameters.h"
|
|
|
|
|
#include "api/rtp_transceiver_direction.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "media/base/media_constants.h"
|
2021-01-29 14:45:08 +00:00
|
|
|
#include "media/base/rid_description.h"
|
|
|
|
|
#include "media/base/stream_params.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "p2p/base/ice_credentials_iterator.h"
|
2021-01-29 14:45:08 +00:00
|
|
|
#include "p2p/base/transport_description.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "p2p/base/transport_description_factory.h"
|
2021-01-29 14:45:08 +00:00
|
|
|
#include "p2p/base/transport_info.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "pc/jsep_transport.h"
|
2019-05-13 13:36:16 +02:00
|
|
|
#include "pc/media_protocol_names.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "pc/session_description.h"
|
2021-01-29 14:45:08 +00:00
|
|
|
#include "pc/simulcast_description.h"
|
2019-01-25 17:13:56 -08:00
|
|
|
#include "rtc_base/unique_id_generator.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace cricket {
|
|
|
|
|
|
|
|
|
|
class ChannelManager;
|
|
|
|
|
|
2016-05-06 18:40:30 -07:00
|
|
|
// Default RTCP CNAME for unit tests.
|
|
|
|
|
const char kDefaultRtcpCname[] = "DefaultRtcpCname";
|
|
|
|
|
|
2017-08-17 14:10:50 -07:00
|
|
|
// Options for an RtpSender contained with an media description/"m=" section.
|
2019-01-02 10:13:58 -08:00
|
|
|
// Note: Spec-compliant Simulcast and legacy simulcast are mutually exclusive.
|
2017-08-17 14:10:50 -07:00
|
|
|
struct SenderOptions {
|
|
|
|
|
std::string track_id;
|
2017-08-31 15:45:38 -07:00
|
|
|
std::vector<std::string> stream_ids;
|
2019-01-02 10:13:58 -08:00
|
|
|
// Use RIDs and Simulcast Layers to indicate spec-compliant Simulcast.
|
|
|
|
|
std::vector<RidDescription> rids;
|
|
|
|
|
SimulcastLayerList simulcast_layers;
|
2021-07-27 22:09:55 +00:00
|
|
|
// Use |num_sim_layers| to indicate legacy simulcast.
|
2017-08-17 14:10:50 -07:00
|
|
|
int num_sim_layers;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Options for an individual media description/"m=" section.
|
|
|
|
|
struct MediaDescriptionOptions {
|
|
|
|
|
MediaDescriptionOptions(MediaType type,
|
|
|
|
|
const std::string& mid,
|
2017-11-27 14:30:09 -08:00
|
|
|
webrtc::RtpTransceiverDirection direction,
|
2017-08-17 14:10:50 -07:00
|
|
|
bool stopped)
|
|
|
|
|
: type(type), mid(mid), direction(direction), stopped(stopped) {}
|
|
|
|
|
|
|
|
|
|
// TODO(deadbeef): When we don't support Plan B, there will only be one
|
|
|
|
|
// sender per media description and this can be simplified.
|
|
|
|
|
void AddAudioSender(const std::string& track_id,
|
2017-08-31 15:45:38 -07:00
|
|
|
const std::vector<std::string>& stream_ids);
|
2017-08-17 14:10:50 -07:00
|
|
|
void AddVideoSender(const std::string& track_id,
|
2017-08-31 15:45:38 -07:00
|
|
|
const std::vector<std::string>& stream_ids,
|
2019-01-02 10:13:58 -08:00
|
|
|
const std::vector<RidDescription>& rids,
|
|
|
|
|
const SimulcastLayerList& simulcast_layers,
|
2013-10-30 05:18:12 +00:00
|
|
|
int num_sim_layers);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2017-08-17 14:10:50 -07:00
|
|
|
MediaType type;
|
|
|
|
|
std::string mid;
|
2017-11-27 14:30:09 -08:00
|
|
|
webrtc::RtpTransceiverDirection direction;
|
2017-08-17 14:10:50 -07:00
|
|
|
bool stopped;
|
|
|
|
|
TransportOptions transport_options;
|
|
|
|
|
// Note: There's no equivalent "RtpReceiverOptions" because only send
|
|
|
|
|
// stream information goes in the local descriptions.
|
|
|
|
|
std::vector<SenderOptions> sender_options;
|
2019-04-23 19:25:51 +02:00
|
|
|
std::vector<webrtc::RtpCodecCapability> codec_preferences;
|
2020-06-24 01:06:10 +02:00
|
|
|
std::vector<webrtc::RtpHeaderExtensionCapability> header_extensions;
|
2017-08-17 14:10:50 -07:00
|
|
|
|
|
|
|
|
private:
|
2021-07-27 22:09:55 +00:00
|
|
|
// Doesn't DCHECK on |type|.
|
2017-08-17 14:10:50 -07:00
|
|
|
void AddSenderInternal(const std::string& track_id,
|
2017-08-31 15:45:38 -07:00
|
|
|
const std::vector<std::string>& stream_ids,
|
2019-01-02 10:13:58 -08:00
|
|
|
const std::vector<RidDescription>& rids,
|
|
|
|
|
const SimulcastLayerList& simulcast_layers,
|
2013-10-30 05:18:12 +00:00
|
|
|
int num_sim_layers);
|
2017-08-17 14:10:50 -07:00
|
|
|
};
|
2013-10-30 05:18:12 +00:00
|
|
|
|
2017-08-17 14:10:50 -07:00
|
|
|
// Provides a mechanism for describing how m= sections should be generated.
|
|
|
|
|
// The m= section with index X will use media_description_options[X]. There
|
|
|
|
|
// must be an option for each existing section if creating an answer, or a
|
|
|
|
|
// subsequent offer.
|
|
|
|
|
struct MediaSessionOptions {
|
|
|
|
|
MediaSessionOptions() {}
|
2017-08-17 06:50:32 -07:00
|
|
|
|
2017-08-17 14:10:50 -07:00
|
|
|
bool has_audio() const { return HasMediaDescription(MEDIA_TYPE_AUDIO); }
|
|
|
|
|
bool has_video() const { return HasMediaDescription(MEDIA_TYPE_VIDEO); }
|
|
|
|
|
bool has_data() const { return HasMediaDescription(MEDIA_TYPE_DATA); }
|
|
|
|
|
|
|
|
|
|
bool HasMediaDescription(MediaType type) const;
|
|
|
|
|
|
|
|
|
|
bool vad_enabled = true; // When disabled, removes all CN codecs from SDP.
|
|
|
|
|
bool rtcp_mux_enabled = true;
|
|
|
|
|
bool bundle_enabled = false;
|
2018-11-12 10:25:48 +01:00
|
|
|
bool offer_extmap_allow_mixed = false;
|
2019-06-04 15:38:50 +02:00
|
|
|
bool raw_packetization_for_video = false;
|
2017-08-17 14:10:50 -07:00
|
|
|
std::string rtcp_cname = kDefaultRtcpCname;
|
2018-10-11 15:33:17 -07:00
|
|
|
webrtc::CryptoOptions crypto_options;
|
2017-08-17 14:10:50 -07:00
|
|
|
// List of media description options in the same order that the media
|
|
|
|
|
// descriptions will be generated.
|
|
|
|
|
std::vector<MediaDescriptionOptions> media_description_options;
|
2018-10-11 07:47:12 +02:00
|
|
|
std::vector<IceParameters> pooled_ice_credentials;
|
Add x-mt line to the offer.
We already support decoding of the x-mt line. This change adds the
a=x-mt line to the SDP offer. This is not a backward compatible change
for media transport (because of the changes in pre-shared key handling)
1) if media transport is enabled, and SDES is enabled, generate the
media transport offer.
2) if media transport generated the offer, add that offer to the x-mt
line.
3) in order to create media transport, require an x-mt line (backward incompatible).
The way it works is that
1) PeerConnection, on the offerer, asks jsep transport for the
configuration of the media transport.
2) Tentative media transport is created in JsepTransportController when
that happens.
3) SessionDescription will include configuration from this tentative
media transport.
4) When the LocalDescription is set on the offerer, the tentative media
transport is promoted to the real media transport.
Caveats:
- now we really only support MaxBundle. In the previous implementations,
two media transports were briefly created in some tests, and the second
one was destroyed shortly after instantiation.
- we, for now, enforce SDES. In the future, whether SDES is used will be
refactored out of the peer connection.
In the future (on the callee) we should ignore 'is_media_transport' setting. If
Offer contains x-mt, media transport should be used (if the factory is
present). However, we need to decide how to negotiate media transport
for data channels vs data transport for media (x-mt line at this point
doesn't differentiate the two, so we still need to use app setting).
This change also removes the negotation of pre-shared key from the
a=crypto line. Instead, media transport will have its own, 256bit key.
Such key should be transported in the x-mt line. This makes the code
much simpler, and simplifies the dependency / a=crypto lines parsing.
Also, adds a proper test for the connection re-offer (on both sides: callee and caller).
Before, it was possible that media transport could get recreated, based on the offer.
The tests we had didn't test this scenario, and the loopback media factory didn't allow for such test.
This change adds counts to that loopback media factory, and asserts that only 1 media transport is created, even
when there is a re-offer.
Bug: webrtc:9719
Change-Id: Ibd8739af90e914da40ab412454bba8e1529f5a01
Reviewed-on: https://webrtc-review.googlesource.com/c/125040
Reviewed-by: Bjorn Mellem <mellem@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Peter Slatala <psla@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26933}
2019-03-01 11:14:05 -08:00
|
|
|
|
2019-05-14 22:00:01 +02:00
|
|
|
// Use the draft-ietf-mmusic-sctp-sdp-03 obsolete syntax for SCTP
|
|
|
|
|
// datachannels.
|
|
|
|
|
// Default is true for backwards compatibility with clients that use
|
|
|
|
|
// this internal interface.
|
|
|
|
|
bool use_obsolete_sctp_sdp = true;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Creates media session descriptions according to the supplied codecs and
|
|
|
|
|
// other fields, as well as the supplied per-call options.
|
|
|
|
|
// When creating answers, performs the appropriate negotiation
|
|
|
|
|
// of the various fields to determine the proper result.
|
|
|
|
|
class MediaSessionDescriptionFactory {
|
|
|
|
|
public:
|
2019-01-25 17:13:56 -08:00
|
|
|
// Simple constructor that does not set any configuration for the factory.
|
|
|
|
|
// When using this constructor, the methods below can be used to set the
|
|
|
|
|
// configuration.
|
|
|
|
|
// The TransportDescriptionFactory and the UniqueRandomIdGenerator are not
|
|
|
|
|
// owned by MediaSessionDescriptionFactory, so they must be kept alive by the
|
|
|
|
|
// user of this class.
|
|
|
|
|
MediaSessionDescriptionFactory(const TransportDescriptionFactory* factory,
|
|
|
|
|
rtc::UniqueRandomIdGenerator* ssrc_generator);
|
2013-07-10 00:45:36 +00:00
|
|
|
// This helper automatically sets up the factory to get its configuration
|
|
|
|
|
// from the specified ChannelManager.
|
|
|
|
|
MediaSessionDescriptionFactory(ChannelManager* cmanager,
|
2019-01-25 17:13:56 -08:00
|
|
|
const TransportDescriptionFactory* factory,
|
|
|
|
|
rtc::UniqueRandomIdGenerator* ssrc_generator);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2016-06-14 07:12:39 -07:00
|
|
|
const AudioCodecs& audio_sendrecv_codecs() const;
|
2016-06-14 03:29:38 -07:00
|
|
|
const AudioCodecs& audio_send_codecs() const;
|
|
|
|
|
const AudioCodecs& audio_recv_codecs() const;
|
|
|
|
|
void set_audio_codecs(const AudioCodecs& send_codecs,
|
|
|
|
|
const AudioCodecs& recv_codecs);
|
2020-03-29 22:17:00 +02:00
|
|
|
const VideoCodecs& video_sendrecv_codecs() const;
|
|
|
|
|
const VideoCodecs& video_send_codecs() const;
|
|
|
|
|
const VideoCodecs& video_recv_codecs() const;
|
|
|
|
|
void set_video_codecs(const VideoCodecs& send_codecs,
|
|
|
|
|
const VideoCodecs& recv_codecs);
|
2020-06-24 01:06:10 +02:00
|
|
|
RtpHeaderExtensions filtered_rtp_header_extensions(
|
|
|
|
|
RtpHeaderExtensions extensions) const;
|
2013-07-10 00:45:36 +00:00
|
|
|
SecurePolicy secure() const { return secure_; }
|
|
|
|
|
void set_secure(SecurePolicy s) { secure_ = s; }
|
|
|
|
|
|
2017-06-29 12:31:36 -07:00
|
|
|
void set_enable_encrypted_rtp_header_extensions(bool enable) {
|
|
|
|
|
enable_encrypted_rtp_header_extensions_ = enable;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-10 16:08:05 -08:00
|
|
|
void set_is_unified_plan(bool is_unified_plan) {
|
|
|
|
|
is_unified_plan_ = is_unified_plan;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-11 10:15:23 -08:00
|
|
|
std::unique_ptr<SessionDescription> CreateOffer(
|
2013-07-10 00:45:36 +00:00
|
|
|
const MediaSessionOptions& options,
|
|
|
|
|
const SessionDescription* current_description) const;
|
2018-12-11 10:15:23 -08:00
|
|
|
std::unique_ptr<SessionDescription> CreateAnswer(
|
2017-02-17 19:48:38 -08:00
|
|
|
const SessionDescription* offer,
|
|
|
|
|
const MediaSessionOptions& options,
|
|
|
|
|
const SessionDescription* current_description) const;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
private:
|
2020-06-24 01:06:10 +02:00
|
|
|
struct AudioVideoRtpHeaderExtensions {
|
|
|
|
|
RtpHeaderExtensions audio;
|
|
|
|
|
RtpHeaderExtensions video;
|
|
|
|
|
};
|
|
|
|
|
|
2016-06-14 03:29:38 -07:00
|
|
|
const AudioCodecs& GetAudioCodecsForOffer(
|
2017-11-27 14:30:09 -08:00
|
|
|
const webrtc::RtpTransceiverDirection& direction) const;
|
2016-06-14 03:29:38 -07:00
|
|
|
const AudioCodecs& GetAudioCodecsForAnswer(
|
2017-11-27 14:30:09 -08:00
|
|
|
const webrtc::RtpTransceiverDirection& offer,
|
|
|
|
|
const webrtc::RtpTransceiverDirection& answer) const;
|
2020-03-29 22:17:00 +02:00
|
|
|
const VideoCodecs& GetVideoCodecsForOffer(
|
|
|
|
|
const webrtc::RtpTransceiverDirection& direction) const;
|
|
|
|
|
const VideoCodecs& GetVideoCodecsForAnswer(
|
|
|
|
|
const webrtc::RtpTransceiverDirection& offer,
|
|
|
|
|
const webrtc::RtpTransceiverDirection& answer) const;
|
2018-12-10 14:25:30 -08:00
|
|
|
void GetCodecsForOffer(
|
|
|
|
|
const std::vector<const ContentInfo*>& current_active_contents,
|
|
|
|
|
AudioCodecs* audio_codecs,
|
2021-04-16 11:12:14 +00:00
|
|
|
VideoCodecs* video_codecs) const;
|
2018-12-10 14:25:30 -08:00
|
|
|
void GetCodecsForAnswer(
|
|
|
|
|
const std::vector<const ContentInfo*>& current_active_contents,
|
|
|
|
|
const SessionDescription& remote_offer,
|
|
|
|
|
AudioCodecs* audio_codecs,
|
2021-04-16 11:12:14 +00:00
|
|
|
VideoCodecs* video_codecs) const;
|
2020-06-24 01:06:10 +02:00
|
|
|
AudioVideoRtpHeaderExtensions GetOfferedRtpHeaderExtensionsWithIds(
|
2018-12-10 14:25:30 -08:00
|
|
|
const std::vector<const ContentInfo*>& current_active_contents,
|
2019-06-20 15:37:52 +02:00
|
|
|
bool extmap_allow_mixed,
|
2020-06-24 01:06:10 +02:00
|
|
|
const std::vector<MediaDescriptionOptions>& media_description_options)
|
|
|
|
|
const;
|
2013-07-10 00:45:36 +00:00
|
|
|
bool AddTransportOffer(const std::string& content_name,
|
|
|
|
|
const TransportOptions& transport_options,
|
|
|
|
|
const SessionDescription* current_desc,
|
2018-10-11 07:47:12 +02:00
|
|
|
SessionDescription* offer,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2018-12-10 17:18:54 -08:00
|
|
|
std::unique_ptr<TransportDescription> CreateTransportAnswer(
|
2013-07-10 00:45:36 +00:00
|
|
|
const std::string& content_name,
|
|
|
|
|
const SessionDescription* offer_desc,
|
|
|
|
|
const TransportOptions& transport_options,
|
2017-02-22 19:35:18 -08:00
|
|
|
const SessionDescription* current_desc,
|
2018-10-11 07:47:12 +02:00
|
|
|
bool require_transport_attributes,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
bool AddTransportAnswer(const std::string& content_name,
|
|
|
|
|
const TransportDescription& transport_desc,
|
|
|
|
|
SessionDescription* answer_desc) const;
|
|
|
|
|
|
2014-08-05 19:19:05 +00:00
|
|
|
// Helpers for adding media contents to the SessionDescription. Returns true
|
|
|
|
|
// it succeeds or the media content is not needed, or false if there is any
|
|
|
|
|
// error.
|
|
|
|
|
|
|
|
|
|
bool AddAudioContentForOffer(
|
2017-08-17 14:10:50 -07:00
|
|
|
const MediaDescriptionOptions& media_description_options,
|
|
|
|
|
const MediaSessionOptions& session_options,
|
|
|
|
|
const ContentInfo* current_content,
|
2014-08-05 19:19:05 +00:00
|
|
|
const SessionDescription* current_description,
|
|
|
|
|
const RtpHeaderExtensions& audio_rtp_extensions,
|
|
|
|
|
const AudioCodecs& audio_codecs,
|
|
|
|
|
StreamParamsVec* current_streams,
|
2018-10-11 07:47:12 +02:00
|
|
|
SessionDescription* desc,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
2014-08-05 19:19:05 +00:00
|
|
|
|
|
|
|
|
bool AddVideoContentForOffer(
|
2017-08-17 14:10:50 -07:00
|
|
|
const MediaDescriptionOptions& media_description_options,
|
|
|
|
|
const MediaSessionOptions& session_options,
|
|
|
|
|
const ContentInfo* current_content,
|
2014-08-05 19:19:05 +00:00
|
|
|
const SessionDescription* current_description,
|
|
|
|
|
const RtpHeaderExtensions& video_rtp_extensions,
|
|
|
|
|
const VideoCodecs& video_codecs,
|
|
|
|
|
StreamParamsVec* current_streams,
|
2018-10-11 07:47:12 +02:00
|
|
|
SessionDescription* desc,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
2014-08-05 19:19:05 +00:00
|
|
|
|
|
|
|
|
bool AddDataContentForOffer(
|
2017-08-17 14:10:50 -07:00
|
|
|
const MediaDescriptionOptions& media_description_options,
|
|
|
|
|
const MediaSessionOptions& session_options,
|
|
|
|
|
const ContentInfo* current_content,
|
2014-08-05 19:19:05 +00:00
|
|
|
const SessionDescription* current_description,
|
|
|
|
|
StreamParamsVec* current_streams,
|
2018-10-11 07:47:12 +02:00
|
|
|
SessionDescription* desc,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
2014-08-05 19:19:05 +00:00
|
|
|
|
2020-10-13 12:43:15 +02:00
|
|
|
bool AddUnsupportedContentForOffer(
|
|
|
|
|
const MediaDescriptionOptions& media_description_options,
|
|
|
|
|
const MediaSessionOptions& session_options,
|
|
|
|
|
const ContentInfo* current_content,
|
|
|
|
|
const SessionDescription* current_description,
|
|
|
|
|
SessionDescription* desc,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
|
|
|
|
|
2017-08-17 14:10:50 -07:00
|
|
|
bool AddAudioContentForAnswer(
|
|
|
|
|
const MediaDescriptionOptions& media_description_options,
|
|
|
|
|
const MediaSessionOptions& session_options,
|
|
|
|
|
const ContentInfo* offer_content,
|
|
|
|
|
const SessionDescription* offer_description,
|
|
|
|
|
const ContentInfo* current_content,
|
|
|
|
|
const SessionDescription* current_description,
|
|
|
|
|
const TransportInfo* bundle_transport,
|
|
|
|
|
const AudioCodecs& audio_codecs,
|
2020-06-24 01:06:10 +02:00
|
|
|
const RtpHeaderExtensions& default_audio_rtp_header_extensions,
|
2017-08-17 14:10:50 -07:00
|
|
|
StreamParamsVec* current_streams,
|
2018-10-11 07:47:12 +02:00
|
|
|
SessionDescription* answer,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
2017-08-17 14:10:50 -07:00
|
|
|
|
|
|
|
|
bool AddVideoContentForAnswer(
|
|
|
|
|
const MediaDescriptionOptions& media_description_options,
|
|
|
|
|
const MediaSessionOptions& session_options,
|
|
|
|
|
const ContentInfo* offer_content,
|
|
|
|
|
const SessionDescription* offer_description,
|
|
|
|
|
const ContentInfo* current_content,
|
|
|
|
|
const SessionDescription* current_description,
|
|
|
|
|
const TransportInfo* bundle_transport,
|
|
|
|
|
const VideoCodecs& video_codecs,
|
2020-06-24 01:06:10 +02:00
|
|
|
const RtpHeaderExtensions& default_video_rtp_header_extensions,
|
2017-08-17 14:10:50 -07:00
|
|
|
StreamParamsVec* current_streams,
|
2018-10-11 07:47:12 +02:00
|
|
|
SessionDescription* answer,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
2017-08-17 14:10:50 -07:00
|
|
|
|
|
|
|
|
bool AddDataContentForAnswer(
|
|
|
|
|
const MediaDescriptionOptions& media_description_options,
|
|
|
|
|
const MediaSessionOptions& session_options,
|
|
|
|
|
const ContentInfo* offer_content,
|
|
|
|
|
const SessionDescription* offer_description,
|
|
|
|
|
const ContentInfo* current_content,
|
|
|
|
|
const SessionDescription* current_description,
|
|
|
|
|
const TransportInfo* bundle_transport,
|
|
|
|
|
StreamParamsVec* current_streams,
|
2018-10-11 07:47:12 +02:00
|
|
|
SessionDescription* answer,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
2017-08-17 14:10:50 -07:00
|
|
|
|
2020-10-13 12:43:15 +02:00
|
|
|
bool AddUnsupportedContentForAnswer(
|
|
|
|
|
const MediaDescriptionOptions& media_description_options,
|
|
|
|
|
const MediaSessionOptions& session_options,
|
|
|
|
|
const ContentInfo* offer_content,
|
|
|
|
|
const SessionDescription* offer_description,
|
|
|
|
|
const ContentInfo* current_content,
|
|
|
|
|
const SessionDescription* current_description,
|
|
|
|
|
const TransportInfo* bundle_transport,
|
|
|
|
|
SessionDescription* answer,
|
|
|
|
|
IceCredentialsIterator* ice_credentials) const;
|
|
|
|
|
|
2017-08-17 14:10:50 -07:00
|
|
|
void ComputeAudioCodecsIntersectionAndUnion();
|
2014-08-05 19:19:05 +00:00
|
|
|
|
2020-03-29 22:17:00 +02:00
|
|
|
void ComputeVideoCodecsIntersectionAndUnion();
|
|
|
|
|
|
2018-12-10 16:08:05 -08:00
|
|
|
bool is_unified_plan_ = false;
|
2016-06-14 03:29:38 -07:00
|
|
|
AudioCodecs audio_send_codecs_;
|
|
|
|
|
AudioCodecs audio_recv_codecs_;
|
2017-08-17 14:10:50 -07:00
|
|
|
// Intersection of send and recv.
|
2016-06-14 03:29:38 -07:00
|
|
|
AudioCodecs audio_sendrecv_codecs_;
|
2017-08-17 14:10:50 -07:00
|
|
|
// Union of send and recv.
|
|
|
|
|
AudioCodecs all_audio_codecs_;
|
2020-03-29 22:17:00 +02:00
|
|
|
VideoCodecs video_send_codecs_;
|
|
|
|
|
VideoCodecs video_recv_codecs_;
|
|
|
|
|
// Intersection of send and recv.
|
|
|
|
|
VideoCodecs video_sendrecv_codecs_;
|
|
|
|
|
// Union of send and recv.
|
|
|
|
|
VideoCodecs all_video_codecs_;
|
2019-01-25 17:13:56 -08:00
|
|
|
// This object is not owned by the channel so it must outlive it.
|
|
|
|
|
rtc::UniqueRandomIdGenerator* const ssrc_generator_;
|
2017-06-29 12:31:36 -07:00
|
|
|
bool enable_encrypted_rtp_header_extensions_ = false;
|
2017-08-17 14:10:50 -07:00
|
|
|
// TODO(zhihuang): Rename secure_ to sdec_policy_; rename the related getter
|
|
|
|
|
// and setter.
|
|
|
|
|
SecurePolicy secure_ = SEC_DISABLED;
|
2013-07-10 00:45:36 +00:00
|
|
|
const TransportDescriptionFactory* transport_desc_factory_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Convenience functions.
|
|
|
|
|
bool IsMediaContent(const ContentInfo* content);
|
|
|
|
|
bool IsAudioContent(const ContentInfo* content);
|
|
|
|
|
bool IsVideoContent(const ContentInfo* content);
|
|
|
|
|
bool IsDataContent(const ContentInfo* content);
|
2020-10-13 12:43:15 +02:00
|
|
|
bool IsUnsupportedContent(const ContentInfo* content);
|
2016-02-23 17:24:52 -08:00
|
|
|
const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
|
|
|
|
|
MediaType media_type);
|
2013-07-10 00:45:36 +00:00
|
|
|
const ContentInfo* GetFirstAudioContent(const ContentInfos& contents);
|
|
|
|
|
const ContentInfo* GetFirstVideoContent(const ContentInfos& contents);
|
|
|
|
|
const ContentInfo* GetFirstDataContent(const ContentInfos& contents);
|
2018-01-22 10:21:56 -08:00
|
|
|
const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc,
|
|
|
|
|
MediaType media_type);
|
2013-07-10 00:45:36 +00:00
|
|
|
const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc);
|
|
|
|
|
const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc);
|
|
|
|
|
const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc);
|
|
|
|
|
const AudioContentDescription* GetFirstAudioContentDescription(
|
|
|
|
|
const SessionDescription* sdesc);
|
|
|
|
|
const VideoContentDescription* GetFirstVideoContentDescription(
|
|
|
|
|
const SessionDescription* sdesc);
|
2019-05-13 13:36:16 +02:00
|
|
|
const SctpDataContentDescription* GetFirstSctpDataContentDescription(
|
|
|
|
|
const SessionDescription* sdesc);
|
2016-05-12 08:14:50 -07:00
|
|
|
// Non-const versions of the above functions.
|
|
|
|
|
// Useful when modifying an existing description.
|
2017-10-30 09:57:42 -07:00
|
|
|
ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type);
|
|
|
|
|
ContentInfo* GetFirstAudioContent(ContentInfos* contents);
|
|
|
|
|
ContentInfo* GetFirstVideoContent(ContentInfos* contents);
|
|
|
|
|
ContentInfo* GetFirstDataContent(ContentInfos* contents);
|
2018-01-22 10:21:56 -08:00
|
|
|
ContentInfo* GetFirstMediaContent(SessionDescription* sdesc,
|
|
|
|
|
MediaType media_type);
|
2016-05-12 08:14:50 -07:00
|
|
|
ContentInfo* GetFirstAudioContent(SessionDescription* sdesc);
|
|
|
|
|
ContentInfo* GetFirstVideoContent(SessionDescription* sdesc);
|
|
|
|
|
ContentInfo* GetFirstDataContent(SessionDescription* sdesc);
|
|
|
|
|
AudioContentDescription* GetFirstAudioContentDescription(
|
|
|
|
|
SessionDescription* sdesc);
|
|
|
|
|
VideoContentDescription* GetFirstVideoContentDescription(
|
|
|
|
|
SessionDescription* sdesc);
|
2019-05-13 13:36:16 +02:00
|
|
|
SctpDataContentDescription* GetFirstSctpDataContentDescription(
|
|
|
|
|
SessionDescription* sdesc);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
Negotiate the same SRTP crypto suites for every DTLS association formed.
Before this CL, we would negotiate:
- No crypto suites for data m= sections.
- A full set for audio m= sections.
- The full set, minus SRTP_AES128_CM_SHA1_32 for video m= sections.
However, this doesn't make sense with BUNDLE, since any DTLS
association could end up being used for any type of media. If
video is "bundled on" the audio transport (which is typical), it
will actually end up using SRTP_AES128_CM_SHA1_32.
So, this CL moves the responsibility of deciding SRTP crypto suites out
of BaseChannel and into DtlsTransport. The only two possibilities are
now "normal set" or "normal set + GCM", if enabled by the PC factory
options.
This fixes an issue (see linked bug) that was occurring when audio/video
were "bundled onto" the data transport. Since the data transport
wasn't negotiating any SRTP crypto suites, none were available to use
for audio/video, so the application would get black video/no audio.
This CL doesn't affect the SDES SRTP crypto suite negotiation;
it only affects the negotiation in the DLTS handshake, through
the use_srtp extension.
BUG=chromium:711243
Review-Url: https://codereview.webrtc.org/2815513012
Cr-Commit-Position: refs/heads/master@{#17810}
2017-04-21 03:23:33 -07:00
|
|
|
// Helper functions to return crypto suites used for SDES.
|
2018-10-11 15:33:17 -07:00
|
|
|
void GetSupportedAudioSdesCryptoSuites(
|
|
|
|
|
const webrtc::CryptoOptions& crypto_options,
|
|
|
|
|
std::vector<int>* crypto_suites);
|
|
|
|
|
void GetSupportedVideoSdesCryptoSuites(
|
|
|
|
|
const webrtc::CryptoOptions& crypto_options,
|
|
|
|
|
std::vector<int>* crypto_suites);
|
|
|
|
|
void GetSupportedDataSdesCryptoSuites(
|
|
|
|
|
const webrtc::CryptoOptions& crypto_options,
|
|
|
|
|
std::vector<int>* crypto_suites);
|
Negotiate the same SRTP crypto suites for every DTLS association formed.
Before this CL, we would negotiate:
- No crypto suites for data m= sections.
- A full set for audio m= sections.
- The full set, minus SRTP_AES128_CM_SHA1_32 for video m= sections.
However, this doesn't make sense with BUNDLE, since any DTLS
association could end up being used for any type of media. If
video is "bundled on" the audio transport (which is typical), it
will actually end up using SRTP_AES128_CM_SHA1_32.
So, this CL moves the responsibility of deciding SRTP crypto suites out
of BaseChannel and into DtlsTransport. The only two possibilities are
now "normal set" or "normal set + GCM", if enabled by the PC factory
options.
This fixes an issue (see linked bug) that was occurring when audio/video
were "bundled onto" the data transport. Since the data transport
wasn't negotiating any SRTP crypto suites, none were available to use
for audio/video, so the application would get black video/no audio.
This CL doesn't affect the SDES SRTP crypto suite negotiation;
it only affects the negotiation in the DLTS handshake, through
the use_srtp extension.
BUG=chromium:711243
Review-Url: https://codereview.webrtc.org/2815513012
Cr-Commit-Position: refs/heads/master@{#17810}
2017-04-21 03:23:33 -07:00
|
|
|
void GetSupportedAudioSdesCryptoSuiteNames(
|
2018-10-11 15:33:17 -07:00
|
|
|
const webrtc::CryptoOptions& crypto_options,
|
2015-11-18 19:41:53 -08:00
|
|
|
std::vector<std::string>* crypto_suite_names);
|
Negotiate the same SRTP crypto suites for every DTLS association formed.
Before this CL, we would negotiate:
- No crypto suites for data m= sections.
- A full set for audio m= sections.
- The full set, minus SRTP_AES128_CM_SHA1_32 for video m= sections.
However, this doesn't make sense with BUNDLE, since any DTLS
association could end up being used for any type of media. If
video is "bundled on" the audio transport (which is typical), it
will actually end up using SRTP_AES128_CM_SHA1_32.
So, this CL moves the responsibility of deciding SRTP crypto suites out
of BaseChannel and into DtlsTransport. The only two possibilities are
now "normal set" or "normal set + GCM", if enabled by the PC factory
options.
This fixes an issue (see linked bug) that was occurring when audio/video
were "bundled onto" the data transport. Since the data transport
wasn't negotiating any SRTP crypto suites, none were available to use
for audio/video, so the application would get black video/no audio.
This CL doesn't affect the SDES SRTP crypto suite negotiation;
it only affects the negotiation in the DLTS handshake, through
the use_srtp extension.
BUG=chromium:711243
Review-Url: https://codereview.webrtc.org/2815513012
Cr-Commit-Position: refs/heads/master@{#17810}
2017-04-21 03:23:33 -07:00
|
|
|
void GetSupportedVideoSdesCryptoSuiteNames(
|
2018-10-11 15:33:17 -07:00
|
|
|
const webrtc::CryptoOptions& crypto_options,
|
2015-11-18 19:41:53 -08:00
|
|
|
std::vector<std::string>* crypto_suite_names);
|
Negotiate the same SRTP crypto suites for every DTLS association formed.
Before this CL, we would negotiate:
- No crypto suites for data m= sections.
- A full set for audio m= sections.
- The full set, minus SRTP_AES128_CM_SHA1_32 for video m= sections.
However, this doesn't make sense with BUNDLE, since any DTLS
association could end up being used for any type of media. If
video is "bundled on" the audio transport (which is typical), it
will actually end up using SRTP_AES128_CM_SHA1_32.
So, this CL moves the responsibility of deciding SRTP crypto suites out
of BaseChannel and into DtlsTransport. The only two possibilities are
now "normal set" or "normal set + GCM", if enabled by the PC factory
options.
This fixes an issue (see linked bug) that was occurring when audio/video
were "bundled onto" the data transport. Since the data transport
wasn't negotiating any SRTP crypto suites, none were available to use
for audio/video, so the application would get black video/no audio.
This CL doesn't affect the SDES SRTP crypto suite negotiation;
it only affects the negotiation in the DLTS handshake, through
the use_srtp extension.
BUG=chromium:711243
Review-Url: https://codereview.webrtc.org/2815513012
Cr-Commit-Position: refs/heads/master@{#17810}
2017-04-21 03:23:33 -07:00
|
|
|
void GetSupportedDataSdesCryptoSuiteNames(
|
2018-10-11 15:33:17 -07:00
|
|
|
const webrtc::CryptoOptions& crypto_options,
|
2015-11-18 19:41:53 -08:00
|
|
|
std::vector<std::string>* crypto_suite_names);
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
} // namespace cricket
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#endif // PC_MEDIA_SESSION_H_
|