Files
platform-external-webrtc/api/rtptransceiverinterface.h
Seth Hampson 5b4f075f9c Reland "Reland "Adds support for multiple or no media stream ids.""
This is a reland of f351c3408a0c7f695447a2a9f4e6a1719a0d6a26

Reland history:
The original CL broke tests in chromium which were manually tested in
the first reland. Another small fix was added to the reland to fix a
downstream bug, which caused separate tests to fail in chromium.
These were not caught because the chromium trybot was down. These
are temporarily disabled in chrome to allow this change to roll in.

Original change's description:
> Reland "Adds support for multiple or no media stream ids."
>
> This is a reland of 1550292efe680ac79a18004705c908b1cdca54cb
>
> Original change's description:
> > Adds support for multiple or no media stream ids.
> >
> > With Unified Plan SDP semantics, this adds support for specifying
> > either no media stream ids or multiple media stream ids for a
> > transceiver/sender/receiver. This includes serializing/deserializing
> > SDPs with multiple a=msid lines in a m section, or an "a=msid:-
> > <appdata>" line to indicate the no stream case. Note that this does
> > not synchronize between multiple streams, this is still just supported
> > based upon the first media stream id.
> >
> > Bug: webrtc:7932, webrtc:7933
> > Change-Id: Ib7433929af7b2925abe2824b485b360cec12f275
> > Reviewed-on: https://webrtc-review.googlesource.com/61341
> > Commit-Queue: Seth Hampson <shampson@webrtc.org>
> > Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> > Reviewed-by: Steve Anton <steveanton@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22611}
>
> Bug: webrtc:7932, webrtc:7933
> Change-Id: Ica272ac18088103e65cccf6b96a6d3ecccb178ed
> Reviewed-on: https://webrtc-review.googlesource.com/65560
> Commit-Queue: Seth Hampson <shampson@webrtc.org>
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22687}

TBR=deadbeef@webrtc.org

Bug: webrtc:7932, webrtc:7933
Change-Id: Ideb30219b2f952dd51428cd4e8bd43ef49df5b17
Reviewed-on: https://webrtc-review.googlesource.com/66280
Commit-Queue: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22699}
2018-04-03 01:10:07 +00:00

131 lines
5.6 KiB
C++

/*
* Copyright 2017 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 API_RTPTRANSCEIVERINTERFACE_H_
#define API_RTPTRANSCEIVERINTERFACE_H_
#include <string>
#include <vector>
#include "api/optional.h"
#include "api/rtpreceiverinterface.h"
#include "api/rtpsenderinterface.h"
#include "rtc_base/refcount.h"
namespace webrtc {
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverdirection
enum class RtpTransceiverDirection {
kSendRecv,
kSendOnly,
kRecvOnly,
kInactive
};
// This is provided as a debugging aid. The format of the output is unspecified.
std::ostream& operator<<(std::ostream& os, RtpTransceiverDirection direction);
// Structure for initializing an RtpTransceiver in a call to
// PeerConnectionInterface::AddTransceiver.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
struct RtpTransceiverInit final {
// Direction of the RtpTransceiver. See RtpTransceiverInterface::direction().
RtpTransceiverDirection direction = RtpTransceiverDirection::kSendRecv;
// The added RtpTransceiver will be added to these streams.
std::vector<std::string> stream_ids;
// TODO(bugs.webrtc.org/7600): Not implemented.
std::vector<RtpEncodingParameters> send_encodings;
};
// The RtpTransceiverInterface maps to the RTCRtpTransceiver defined by the
// WebRTC specification. A transceiver represents a combination of an RtpSender
// and an RtpReceiver than share a common mid. As defined in JSEP, an
// RtpTransceiver is said to be associated with a media description if its mid
// property is non-null; otherwise, it is said to be disassociated.
// JSEP: https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24
//
// Note that RtpTransceivers are only supported when using PeerConnection with
// Unified Plan SDP.
//
// This class is thread-safe.
//
// WebRTC specification for RTCRtpTransceiver, the JavaScript analog:
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver
class RtpTransceiverInterface : public rtc::RefCountInterface {
public:
// Media type of the transceiver. Any sender(s)/receiver(s) will have this
// type as well.
virtual cricket::MediaType media_type() const = 0;
// The mid attribute is the mid negotiated and present in the local and
// remote descriptions. Before negotiation is complete, the mid value may be
// null. After rollbacks, the value may change from a non-null value to null.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid
virtual rtc::Optional<std::string> mid() const = 0;
// The sender attribute exposes the RtpSender corresponding to the RTP media
// that may be sent with the transceiver's mid. The sender is always present,
// regardless of the direction of media.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender
virtual rtc::scoped_refptr<RtpSenderInterface> sender() const = 0;
// The receiver attribute exposes the RtpReceiver corresponding to the RTP
// media that may be received with the transceiver's mid. The receiver is
// always present, regardless of the direction of media.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-receiver
virtual rtc::scoped_refptr<RtpReceiverInterface> receiver() const = 0;
// The stopped attribute indicates that the sender of this transceiver will no
// longer send, and that the receiver will no longer receive. It is true if
// either stop has been called or if setting the local or remote description
// has caused the RtpTransceiver to be stopped.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped
virtual bool stopped() const = 0;
// The direction attribute indicates the preferred direction of this
// transceiver, which will be used in calls to CreateOffer and CreateAnswer.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
virtual RtpTransceiverDirection direction() const = 0;
// Sets the preferred direction of this transceiver. An update of
// directionality does not take effect immediately. Instead, future calls to
// CreateOffer and CreateAnswer mark the corresponding media descriptions as
// sendrecv, sendonly, recvonly, or inactive.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
virtual void SetDirection(RtpTransceiverDirection new_direction) = 0;
// The current_direction attribute indicates the current direction negotiated
// for this transceiver. If this transceiver has never been represented in an
// offer/answer exchange, or if the transceiver is stopped, the value is null.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
virtual rtc::Optional<RtpTransceiverDirection> current_direction() const = 0;
// The Stop method irreversibly stops the RtpTransceiver. The sender of this
// transceiver will no longer send, the receiver will no longer receive.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
virtual void Stop() = 0;
// The SetCodecPreferences method overrides the default codec preferences used
// by WebRTC for this transceiver.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-setcodecpreferences
// TODO(steveanton): Not implemented.
virtual void SetCodecPreferences(
rtc::ArrayView<RtpCodecCapability> codecs) = 0;
protected:
virtual ~RtpTransceiverInterface() = default;
};
} // namespace webrtc
#endif // API_RTPTRANSCEIVERINTERFACE_H_