2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Copyright 2012 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-10 07:54:43 -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
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// This file contains interfaces for MediaStream, MediaTrack and MediaSource.
|
|
|
|
|
// These interfaces are used for implementing MediaStream and MediaTrack as
|
|
|
|
|
// defined in http://dev.w3.org/2011/webrtc/editor/webrtc.html#stream-api. These
|
|
|
|
|
// interfaces must be used only with PeerConnection. PeerConnectionManager
|
|
|
|
|
// interface provides the factory methods to create MediaStream and MediaTracks.
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef API_MEDIASTREAMINTERFACE_H_
|
|
|
|
|
#define API_MEDIASTREAMINTERFACE_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2017-01-02 06:44:41 -08:00
|
|
|
#include <stddef.h>
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2018-06-21 13:32:56 +02:00
|
|
|
#include "absl/types/optional.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/video/video_frame.h"
|
2018-05-11 11:15:30 +02:00
|
|
|
#include "api/video/video_sink_interface.h"
|
2018-05-21 14:09:31 +02:00
|
|
|
#include "api/video/video_source_interface.h"
|
2017-11-24 17:29:59 +01:00
|
|
|
#include "modules/audio_processing/include/audio_processing_statistics.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/refcount.h"
|
|
|
|
|
#include "rtc_base/scoped_ref_ptr.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// Generic observer interface.
|
|
|
|
|
class ObserverInterface {
|
|
|
|
|
public:
|
|
|
|
|
virtual void OnChanged() = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~ObserverInterface() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NotifierInterface {
|
|
|
|
|
public:
|
|
|
|
|
virtual void RegisterObserver(ObserverInterface* observer) = 0;
|
|
|
|
|
virtual void UnregisterObserver(ObserverInterface* observer) = 0;
|
|
|
|
|
|
|
|
|
|
virtual ~NotifierInterface() {}
|
|
|
|
|
};
|
|
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// Base class for sources. A MediaStreamTrack has an underlying source that
|
|
|
|
|
// provides media. A source can be shared by multiple tracks.
|
2014-07-29 17:36:52 +00:00
|
|
|
class MediaSourceInterface : public rtc::RefCountInterface,
|
2013-07-10 00:45:36 +00:00
|
|
|
public NotifierInterface {
|
|
|
|
|
public:
|
|
|
|
|
enum SourceState { kInitializing, kLive, kEnded, kMuted };
|
|
|
|
|
|
|
|
|
|
virtual SourceState state() const = 0;
|
|
|
|
|
|
2015-12-15 04:27:11 -08:00
|
|
|
virtual bool remote() const = 0;
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
protected:
|
2018-02-07 09:38:31 +01:00
|
|
|
~MediaSourceInterface() override = default;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// C++ version of MediaStreamTrack.
|
|
|
|
|
// See: https://www.w3.org/TR/mediacapture-streams/#mediastreamtrack
|
2014-07-29 17:36:52 +00:00
|
|
|
class MediaStreamTrackInterface : public rtc::RefCountInterface,
|
2013-07-10 00:45:36 +00:00
|
|
|
public NotifierInterface {
|
|
|
|
|
public:
|
|
|
|
|
enum TrackState {
|
2016-03-23 00:33:56 -07:00
|
|
|
kLive,
|
|
|
|
|
kEnded,
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
2015-11-25 11:26:01 -08:00
|
|
|
static const char kAudioKind[];
|
|
|
|
|
static const char kVideoKind[];
|
|
|
|
|
|
2016-04-01 01:10:42 -07:00
|
|
|
// The kind() method must return kAudioKind only if the object is a
|
|
|
|
|
// subclass of AudioTrackInterface, and kVideoKind only if the
|
|
|
|
|
// object is a subclass of VideoTrackInterface. It is typically used
|
|
|
|
|
// to protect a static_cast<> to the corresponding subclass.
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual std::string kind() const = 0;
|
2017-02-08 01:38:21 -08:00
|
|
|
|
|
|
|
|
// Track identifier.
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual std::string id() const = 0;
|
2017-02-08 01:38:21 -08:00
|
|
|
|
|
|
|
|
// A disabled track will produce silence (if audio) or black frames (if
|
|
|
|
|
// video). Can be disabled and re-enabled.
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual bool enabled() const = 0;
|
|
|
|
|
virtual bool set_enabled(bool enable) = 0;
|
2013-08-12 23:26:21 +00:00
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// Live or ended. A track will never be live again after becoming ended.
|
|
|
|
|
virtual TrackState state() const = 0;
|
|
|
|
|
|
2013-08-12 23:26:21 +00:00
|
|
|
protected:
|
2018-02-07 09:38:31 +01:00
|
|
|
~MediaStreamTrackInterface() override = default;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// VideoTrackSourceInterface is a reference counted source used for
|
|
|
|
|
// VideoTracks. The same source can be used by multiple VideoTracks.
|
2017-07-31 23:22:01 -07:00
|
|
|
// VideoTrackSourceInterface is designed to be invoked on the signaling thread
|
|
|
|
|
// except for rtc::VideoSourceInterface<VideoFrame> methods that will be invoked
|
|
|
|
|
// on the worker thread via a VideoTrack. A custom implementation of a source
|
|
|
|
|
// can inherit AdaptedVideoTrackSource instead of directly implementing this
|
|
|
|
|
// interface.
|
2016-03-08 01:27:48 +01:00
|
|
|
class VideoTrackSourceInterface : public MediaSourceInterface,
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
public rtc::VideoSourceInterface<VideoFrame> {
|
2016-03-08 01:27:48 +01:00
|
|
|
public:
|
2016-04-01 01:10:42 -07:00
|
|
|
struct Stats {
|
|
|
|
|
// Original size of captured frame, before video adaptation.
|
|
|
|
|
int input_width;
|
|
|
|
|
int input_height;
|
|
|
|
|
};
|
2016-03-08 01:27:48 +01:00
|
|
|
|
2016-03-09 02:39:17 +01:00
|
|
|
// Indicates that parameters suitable for screencasts should be automatically
|
|
|
|
|
// applied to RtpSenders.
|
|
|
|
|
// TODO(perkj): Remove these once all known applications have moved to
|
2017-02-08 01:38:21 -08:00
|
|
|
// explicitly setting suitable parameters for screencasts and don't need this
|
2016-03-09 02:39:17 +01:00
|
|
|
// implicit behavior.
|
|
|
|
|
virtual bool is_screencast() const = 0;
|
|
|
|
|
|
2016-03-31 17:23:39 +02:00
|
|
|
// Indicates that the encoder should denoise video before encoding it.
|
|
|
|
|
// If it is not set, the default configuration is used which is different
|
|
|
|
|
// depending on video codec.
|
2016-03-09 02:39:17 +01:00
|
|
|
// TODO(perkj): Remove this once denoising is done by the source, and not by
|
|
|
|
|
// the encoder.
|
2018-06-21 13:32:56 +02:00
|
|
|
virtual absl::optional<bool> needs_denoising() const = 0;
|
2016-03-08 01:27:48 +01:00
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// Returns false if no stats are available, e.g, for a remote source, or a
|
|
|
|
|
// source which has not seen its first frame yet.
|
|
|
|
|
//
|
|
|
|
|
// Implementation should avoid blocking.
|
2016-04-01 01:10:42 -07:00
|
|
|
virtual bool GetStats(Stats* stats) = 0;
|
|
|
|
|
|
2016-03-08 01:27:48 +01:00
|
|
|
protected:
|
2018-02-07 09:38:31 +01:00
|
|
|
~VideoTrackSourceInterface() override = default;
|
2016-03-08 01:27:48 +01:00
|
|
|
};
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2017-07-31 23:22:01 -07:00
|
|
|
// VideoTrackInterface is designed to be invoked on the signaling thread except
|
|
|
|
|
// for rtc::VideoSourceInterface<VideoFrame> methods that must be invoked
|
|
|
|
|
// on the worker thread.
|
|
|
|
|
// PeerConnectionFactory::CreateVideoTrack can be used for creating a VideoTrack
|
|
|
|
|
// that ensures thread safety and that all methods are called on the right
|
|
|
|
|
// thread.
|
2016-02-26 01:24:58 -08:00
|
|
|
class VideoTrackInterface : public MediaStreamTrackInterface,
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
public rtc::VideoSourceInterface<VideoFrame> {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
2016-12-16 15:39:11 -08:00
|
|
|
// Video track content hint, used to override the source is_screencast
|
|
|
|
|
// property.
|
2018-06-18 08:53:10 +02:00
|
|
|
// See https://crbug.com/653531 and https://w3c.github.io/mst-content-hint.
|
|
|
|
|
enum class ContentHint { kNone, kFluid, kDetailed, kText };
|
2016-12-16 15:39:11 -08:00
|
|
|
|
2017-07-10 02:40:49 -07:00
|
|
|
// Register a video sink for this track. Used to connect the track to the
|
|
|
|
|
// underlying video engine.
|
|
|
|
|
void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
|
|
|
|
|
const rtc::VideoSinkWants& wants) override {}
|
|
|
|
|
void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override {}
|
|
|
|
|
|
2016-03-08 01:27:48 +01:00
|
|
|
virtual VideoTrackSourceInterface* GetSource() const = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2018-02-07 09:38:31 +01:00
|
|
|
virtual ContentHint content_hint() const;
|
2016-12-16 15:39:11 -08:00
|
|
|
virtual void set_content_hint(ContentHint hint) {}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
protected:
|
2018-02-07 09:38:31 +01:00
|
|
|
~VideoTrackInterface() override = default;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
2015-12-15 04:27:11 -08:00
|
|
|
// Interface for receiving audio data from a AudioTrack.
|
|
|
|
|
class AudioTrackSinkInterface {
|
|
|
|
|
public:
|
|
|
|
|
virtual void OnData(const void* audio_data,
|
|
|
|
|
int bits_per_sample,
|
|
|
|
|
int sample_rate,
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
size_t number_of_channels,
|
2015-12-15 04:27:11 -08:00
|
|
|
size_t number_of_frames) = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~AudioTrackSinkInterface() {}
|
|
|
|
|
};
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// AudioSourceInterface is a reference counted source used for AudioTracks.
|
2017-02-08 01:38:21 -08:00
|
|
|
// The same source can be used by multiple AudioTracks.
|
2013-07-10 00:45:36 +00:00
|
|
|
class AudioSourceInterface : public MediaSourceInterface {
|
2014-02-13 23:18:49 +00:00
|
|
|
public:
|
|
|
|
|
class AudioObserver {
|
|
|
|
|
public:
|
|
|
|
|
virtual void OnSetVolume(double volume) = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual ~AudioObserver() {}
|
|
|
|
|
};
|
|
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// TODO(deadbeef): Makes all the interfaces pure virtual after they're
|
|
|
|
|
// implemented in chromium.
|
|
|
|
|
|
|
|
|
|
// Sets the volume of the source. |volume| is in the range of [0, 10].
|
2015-12-12 01:37:01 +01:00
|
|
|
// TODO(tommi): This method should be on the track and ideally volume should
|
|
|
|
|
// be applied in the track in a way that does not affect clones of the track.
|
2014-02-13 23:18:49 +00:00
|
|
|
virtual void SetVolume(double volume) {}
|
|
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// Registers/unregisters observers to the audio source.
|
2014-02-13 23:18:49 +00:00
|
|
|
virtual void RegisterAudioObserver(AudioObserver* observer) {}
|
|
|
|
|
virtual void UnregisterAudioObserver(AudioObserver* observer) {}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-12-15 04:27:11 -08:00
|
|
|
// TODO(tommi): Make pure virtual.
|
|
|
|
|
virtual void AddSink(AudioTrackSinkInterface* sink) {}
|
|
|
|
|
virtual void RemoveSink(AudioTrackSinkInterface* sink) {}
|
2014-02-03 16:57:16 +00:00
|
|
|
};
|
|
|
|
|
|
2014-03-03 18:30:11 +00:00
|
|
|
// Interface of the audio processor used by the audio track to collect
|
|
|
|
|
// statistics.
|
2014-07-29 17:36:52 +00:00
|
|
|
class AudioProcessorInterface : public rtc::RefCountInterface {
|
2014-03-03 18:30:11 +00:00
|
|
|
public:
|
2017-11-20 13:07:16 +01:00
|
|
|
// Deprecated, use AudioProcessorStatistics instead.
|
|
|
|
|
// TODO(ivoc): Remove this when all implementations have switched to the new
|
|
|
|
|
// GetStats function. See b/67926135.
|
2014-03-03 18:30:11 +00:00
|
|
|
struct AudioProcessorStats {
|
2017-01-15 08:29:46 -08:00
|
|
|
AudioProcessorStats()
|
|
|
|
|
: typing_noise_detected(false),
|
|
|
|
|
echo_return_loss(0),
|
|
|
|
|
echo_return_loss_enhancement(0),
|
|
|
|
|
echo_delay_median_ms(0),
|
|
|
|
|
echo_delay_std_ms(0),
|
|
|
|
|
residual_echo_likelihood(0.0f),
|
|
|
|
|
residual_echo_likelihood_recent_max(0.0f),
|
|
|
|
|
aec_divergent_filter_fraction(0.0) {}
|
2014-03-03 18:30:11 +00:00
|
|
|
~AudioProcessorStats() {}
|
|
|
|
|
|
|
|
|
|
bool typing_noise_detected;
|
|
|
|
|
int echo_return_loss;
|
|
|
|
|
int echo_return_loss_enhancement;
|
|
|
|
|
int echo_delay_median_ms;
|
|
|
|
|
int echo_delay_std_ms;
|
2016-10-21 04:10:03 -07:00
|
|
|
float residual_echo_likelihood;
|
2017-01-15 08:29:46 -08:00
|
|
|
float residual_echo_likelihood_recent_max;
|
2016-04-07 16:48:15 +02:00
|
|
|
float aec_divergent_filter_fraction;
|
2014-03-03 18:30:11 +00:00
|
|
|
};
|
2017-11-20 13:07:16 +01:00
|
|
|
// This struct maintains the optionality of the stats, and will replace the
|
|
|
|
|
// regular stats struct when all users have been updated.
|
|
|
|
|
struct AudioProcessorStatistics {
|
|
|
|
|
bool typing_noise_detected = false;
|
2017-11-24 17:29:59 +01:00
|
|
|
AudioProcessingStats apm_statistics;
|
2017-11-20 13:07:16 +01:00
|
|
|
};
|
2014-03-03 18:30:11 +00:00
|
|
|
|
|
|
|
|
// Get audio processor statistics.
|
2017-12-12 10:45:51 +01:00
|
|
|
virtual void GetStats(AudioProcessorStats* stats);
|
2014-03-03 18:30:11 +00:00
|
|
|
|
2017-11-20 13:07:16 +01:00
|
|
|
// Get audio processor statistics. The |has_remote_tracks| argument should be
|
|
|
|
|
// set if there are active remote tracks (this would usually be true during
|
|
|
|
|
// a call). If there are no remote tracks some of the stats will not be set by
|
|
|
|
|
// the AudioProcessor, because they only make sense if there is at least one
|
|
|
|
|
// remote track.
|
|
|
|
|
// TODO(ivoc): Make pure virtual when all implementions are updated.
|
|
|
|
|
virtual AudioProcessorStatistics GetStats(bool has_remote_tracks);
|
|
|
|
|
|
2014-03-03 18:30:11 +00:00
|
|
|
protected:
|
2018-02-07 09:38:31 +01:00
|
|
|
~AudioProcessorInterface() override = default;
|
2014-03-03 18:30:11 +00:00
|
|
|
};
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
class AudioTrackInterface : public MediaStreamTrackInterface {
|
|
|
|
|
public:
|
2017-02-08 01:38:21 -08:00
|
|
|
// TODO(deadbeef): Figure out if the following interface should be const or
|
|
|
|
|
// not.
|
2013-07-10 00:45:36 +00:00
|
|
|
virtual AudioSourceInterface* GetSource() const = 0;
|
|
|
|
|
|
2014-03-03 18:30:11 +00:00
|
|
|
// Add/Remove a sink that will receive the audio data from the track.
|
|
|
|
|
virtual void AddSink(AudioTrackSinkInterface* sink) = 0;
|
|
|
|
|
virtual void RemoveSink(AudioTrackSinkInterface* sink) = 0;
|
|
|
|
|
|
|
|
|
|
// Get the signal level from the audio track.
|
|
|
|
|
// Return true on success, otherwise false.
|
2017-02-08 01:38:21 -08:00
|
|
|
// TODO(deadbeef): Change the interface to int GetSignalLevel() and pure
|
|
|
|
|
// virtual after it's implemented in chromium.
|
2018-02-07 09:38:31 +01:00
|
|
|
virtual bool GetSignalLevel(int* level);
|
2014-03-03 18:30:11 +00:00
|
|
|
|
2017-02-27 14:47:33 -08:00
|
|
|
// Get the audio processor used by the audio track. Return null if the track
|
2014-03-03 18:30:11 +00:00
|
|
|
// does not have any processor.
|
2017-02-08 01:38:21 -08:00
|
|
|
// TODO(deadbeef): Make the interface pure virtual.
|
2018-02-07 09:38:31 +01:00
|
|
|
virtual rtc::scoped_refptr<AudioProcessorInterface> GetAudioProcessor();
|
2014-02-03 16:57:16 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
protected:
|
2018-02-07 09:38:31 +01:00
|
|
|
~AudioTrackInterface() override = default;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
typedef std::vector<rtc::scoped_refptr<AudioTrackInterface> > AudioTrackVector;
|
|
|
|
|
typedef std::vector<rtc::scoped_refptr<VideoTrackInterface> > VideoTrackVector;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2017-02-08 01:38:21 -08:00
|
|
|
// C++ version of https://www.w3.org/TR/mediacapture-streams/#mediastream.
|
|
|
|
|
//
|
|
|
|
|
// A major difference is that remote audio/video tracks (received by a
|
|
|
|
|
// PeerConnection/RtpReceiver) are not synchronized simply by adding them to
|
|
|
|
|
// the same stream; a session description with the correct "a=msid" attributes
|
|
|
|
|
// must be pushed down.
|
|
|
|
|
//
|
|
|
|
|
// Thus, this interface acts as simply a container for tracks.
|
2014-07-29 17:36:52 +00:00
|
|
|
class MediaStreamInterface : public rtc::RefCountInterface,
|
2013-07-10 00:45:36 +00:00
|
|
|
public NotifierInterface {
|
|
|
|
|
public:
|
2018-03-13 16:05:28 -07:00
|
|
|
virtual std::string id() const = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
virtual AudioTrackVector GetAudioTracks() = 0;
|
|
|
|
|
virtual VideoTrackVector GetVideoTracks() = 0;
|
2014-07-29 17:36:52 +00:00
|
|
|
virtual rtc::scoped_refptr<AudioTrackInterface> FindAudioTrack(
|
2013-07-10 00:45:36 +00:00
|
|
|
const std::string& track_id) = 0;
|
2014-07-29 17:36:52 +00:00
|
|
|
virtual rtc::scoped_refptr<VideoTrackInterface> FindVideoTrack(
|
2013-07-10 00:45:36 +00:00
|
|
|
const std::string& track_id) = 0;
|
|
|
|
|
|
|
|
|
|
virtual bool AddTrack(AudioTrackInterface* track) = 0;
|
|
|
|
|
virtual bool AddTrack(VideoTrackInterface* track) = 0;
|
|
|
|
|
virtual bool RemoveTrack(AudioTrackInterface* track) = 0;
|
|
|
|
|
virtual bool RemoveTrack(VideoTrackInterface* track) = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
2018-02-07 09:38:31 +01:00
|
|
|
~MediaStreamInterface() override = default;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // API_MEDIASTREAMINTERFACE_H_
|