VoE2 API draft
BUG=4690 R=jmarusic@webrtc.org, kwiberg@webrtc.org, mflodman@webrtc.org, pbos@webrtc.org Review URL: https://webrtc-codereview.appspot.com/50029004 Cr-Commit-Position: refs/heads/master@{#9392}
This commit is contained in:
@ -39,6 +39,10 @@ FakeAudioReceiveStream::FakeAudioReceiveStream(
|
|||||||
: config_(config), received_packets_(0) {
|
: config_(config), received_packets_(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
webrtc::AudioReceiveStream::Stats FakeAudioReceiveStream::GetStats() const {
|
||||||
|
return webrtc::AudioReceiveStream::Stats();
|
||||||
|
}
|
||||||
|
|
||||||
const webrtc::AudioReceiveStream::Config&
|
const webrtc::AudioReceiveStream::Config&
|
||||||
FakeAudioReceiveStream::GetConfig() const {
|
FakeAudioReceiveStream::GetConfig() const {
|
||||||
return config_;
|
return config_;
|
||||||
@ -230,6 +234,14 @@ webrtc::Call::NetworkState FakeCall::GetNetworkState() const {
|
|||||||
return network_state_;
|
return network_state_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
webrtc::AudioSendStream* FakeCall::CreateAudioSendStream(
|
||||||
|
const webrtc::AudioSendStream::Config& config) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FakeCall::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) {
|
||||||
|
}
|
||||||
|
|
||||||
webrtc::AudioReceiveStream* FakeCall::CreateAudioReceiveStream(
|
webrtc::AudioReceiveStream* FakeCall::CreateAudioReceiveStream(
|
||||||
const webrtc::AudioReceiveStream::Config& config) {
|
const webrtc::AudioReceiveStream::Config& config) {
|
||||||
audio_receive_streams_.push_back(new FakeAudioReceiveStream(config));
|
audio_receive_streams_.push_back(new FakeAudioReceiveStream(config));
|
||||||
|
@ -42,6 +42,8 @@ class FakeAudioReceiveStream : public webrtc::AudioReceiveStream {
|
|||||||
explicit FakeAudioReceiveStream(
|
explicit FakeAudioReceiveStream(
|
||||||
const webrtc::AudioReceiveStream::Config& config);
|
const webrtc::AudioReceiveStream::Config& config);
|
||||||
|
|
||||||
|
webrtc::AudioReceiveStream::Stats GetStats() const override;
|
||||||
|
|
||||||
const webrtc::AudioReceiveStream::Config& GetConfig() const;
|
const webrtc::AudioReceiveStream::Config& GetConfig() const;
|
||||||
|
|
||||||
int received_packets() const { return received_packets_; }
|
int received_packets() const { return received_packets_; }
|
||||||
@ -137,6 +139,10 @@ class FakeCall : public webrtc::Call, public webrtc::PacketReceiver {
|
|||||||
void SetStats(const webrtc::Call::Stats& stats);
|
void SetStats(const webrtc::Call::Stats& stats);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
webrtc::AudioSendStream* CreateAudioSendStream(
|
||||||
|
const webrtc::AudioSendStream::Config& config) override;
|
||||||
|
void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override;
|
||||||
|
|
||||||
webrtc::AudioReceiveStream* CreateAudioReceiveStream(
|
webrtc::AudioReceiveStream* CreateAudioReceiveStream(
|
||||||
const webrtc::AudioReceiveStream::Config& config) override;
|
const webrtc::AudioReceiveStream::Config& config) override;
|
||||||
void DestroyAudioReceiveStream(
|
void DestroyAudioReceiveStream(
|
||||||
|
@ -11,37 +11,50 @@
|
|||||||
#ifndef WEBRTC_AUDIO_RECEIVE_STREAM_H_
|
#ifndef WEBRTC_AUDIO_RECEIVE_STREAM_H_
|
||||||
#define WEBRTC_AUDIO_RECEIVE_STREAM_H_
|
#define WEBRTC_AUDIO_RECEIVE_STREAM_H_
|
||||||
|
|
||||||
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "webrtc/common_types.h"
|
|
||||||
#include "webrtc/config.h"
|
#include "webrtc/config.h"
|
||||||
|
#include "webrtc/typedefs.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
class AudioDecoder;
|
||||||
|
|
||||||
class AudioReceiveStream {
|
class AudioReceiveStream {
|
||||||
public:
|
public:
|
||||||
|
struct Stats {};
|
||||||
|
|
||||||
struct Config {
|
struct Config {
|
||||||
Config() {}
|
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
|
||||||
// Receive-stream specific RTP settings.
|
// Receive-stream specific RTP settings.
|
||||||
struct Rtp {
|
struct Rtp {
|
||||||
Rtp() : remote_ssrc(0) {}
|
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
|
||||||
// Synchronization source (stream identifier) to be received.
|
// Synchronization source (stream identifier) to be received.
|
||||||
uint32_t remote_ssrc;
|
uint32_t remote_ssrc = 0;
|
||||||
|
|
||||||
|
// Sender SSRC used for sending RTCP (such as receiver reports).
|
||||||
|
uint32_t local_ssrc = 0;
|
||||||
|
|
||||||
// RTP header extensions used for the received stream.
|
// RTP header extensions used for the received stream.
|
||||||
std::vector<RtpExtension> extensions;
|
std::vector<RtpExtension> extensions;
|
||||||
} rtp;
|
} rtp;
|
||||||
|
|
||||||
|
// Decoders for every payload that we can receive. Call owns the
|
||||||
|
// AudioDecoder instances once the Config is submitted to
|
||||||
|
// Call::CreateReceiveStream().
|
||||||
|
// TODO(solenberg): Use unique_ptr<> once our std lib fully supports C++11.
|
||||||
|
std::map<uint8_t, AudioDecoder*> decoder_map;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual Stats GetStats() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~AudioReceiveStream() {}
|
virtual ~AudioReceiveStream() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // WEBRTC_AUDIO_RECEIVE_STREAM_H_
|
#endif // WEBRTC_AUDIO_RECEIVE_STREAM_H_
|
||||||
|
54
webrtc/audio_send_stream.h
Normal file
54
webrtc/audio_send_stream.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015 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 WEBRTC_AUDIO_SEND_STREAM_H_
|
||||||
|
#define WEBRTC_AUDIO_SEND_STREAM_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "webrtc/base/scoped_ptr.h"
|
||||||
|
#include "webrtc/config.h"
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
|
||||||
|
#include "webrtc/typedefs.h"
|
||||||
|
|
||||||
|
namespace webrtc {
|
||||||
|
|
||||||
|
class AudioSendStream {
|
||||||
|
public:
|
||||||
|
struct Stats {};
|
||||||
|
|
||||||
|
struct Config {
|
||||||
|
std::string ToString() const;
|
||||||
|
|
||||||
|
// Receive-stream specific RTP settings.
|
||||||
|
struct Rtp {
|
||||||
|
std::string ToString() const;
|
||||||
|
|
||||||
|
// Sender SSRC.
|
||||||
|
uint32_t ssrc = 0;
|
||||||
|
|
||||||
|
// RTP header extensions used for the received stream.
|
||||||
|
std::vector<RtpExtension> extensions;
|
||||||
|
} rtp;
|
||||||
|
|
||||||
|
rtc::scoped_ptr<AudioEncoder> encoder;
|
||||||
|
int cng_payload_type = -1; // pt, or -1 to disable Comfort Noise Generator.
|
||||||
|
int red_payload_type = -1; // pt, or -1 to disable REDundant coding.
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual Stats GetStats() const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~AudioSendStream() {}
|
||||||
|
};
|
||||||
|
} // namespace webrtc
|
||||||
|
|
||||||
|
#endif // WEBRTC_AUDIO_SEND_STREAM_H_
|
@ -15,12 +15,16 @@
|
|||||||
|
|
||||||
#include "webrtc/common_types.h"
|
#include "webrtc/common_types.h"
|
||||||
#include "webrtc/audio_receive_stream.h"
|
#include "webrtc/audio_receive_stream.h"
|
||||||
|
#include "webrtc/audio_send_stream.h"
|
||||||
#include "webrtc/video_receive_stream.h"
|
#include "webrtc/video_receive_stream.h"
|
||||||
#include "webrtc/video_send_stream.h"
|
#include "webrtc/video_send_stream.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
class AudioDeviceModule;
|
||||||
|
class AudioProcessing;
|
||||||
class VoiceEngine;
|
class VoiceEngine;
|
||||||
|
class VoiceEngineObserver;
|
||||||
|
|
||||||
const char* Version();
|
const char* Version();
|
||||||
|
|
||||||
@ -76,6 +80,8 @@ class Call {
|
|||||||
|
|
||||||
static const int kDefaultStartBitrateBps;
|
static const int kDefaultStartBitrateBps;
|
||||||
|
|
||||||
|
// TODO(solenberg): Need to add media type to the interface for outgoing
|
||||||
|
// packets too.
|
||||||
newapi::Transport* send_transport;
|
newapi::Transport* send_transport;
|
||||||
|
|
||||||
// VoiceEngine used for audio/video synchronization for this Call.
|
// VoiceEngine used for audio/video synchronization for this Call.
|
||||||
@ -96,6 +102,12 @@ class Call {
|
|||||||
int start_bitrate_bps;
|
int start_bitrate_bps;
|
||||||
int max_bitrate_bps;
|
int max_bitrate_bps;
|
||||||
} bitrate_config;
|
} bitrate_config;
|
||||||
|
|
||||||
|
struct AudioConfig {
|
||||||
|
AudioDeviceModule* audio_device_manager;
|
||||||
|
AudioProcessing* audio_processing;
|
||||||
|
VoiceEngineObserver* voice_engine_observer;
|
||||||
|
} audio_config;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Stats {
|
struct Stats {
|
||||||
@ -113,6 +125,10 @@ class Call {
|
|||||||
|
|
||||||
static Call* Create(const Call::Config& config);
|
static Call* Create(const Call::Config& config);
|
||||||
|
|
||||||
|
virtual AudioSendStream* CreateAudioSendStream(
|
||||||
|
const AudioSendStream::Config& config) = 0;
|
||||||
|
virtual void DestroyAudioSendStream(AudioSendStream* send_stream) = 0;
|
||||||
|
|
||||||
virtual AudioReceiveStream* CreateAudioReceiveStream(
|
virtual AudioReceiveStream* CreateAudioReceiveStream(
|
||||||
const AudioReceiveStream::Config& config) = 0;
|
const AudioReceiveStream::Config& config) = 0;
|
||||||
virtual void DestroyAudioReceiveStream(
|
virtual void DestroyAudioReceiveStream(
|
||||||
|
@ -63,6 +63,10 @@ AudioReceiveStream::AudioReceiveStream(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const {
|
||||||
|
return webrtc::AudioReceiveStream::Stats();
|
||||||
|
}
|
||||||
|
|
||||||
bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) {
|
bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ class AudioReceiveStream : public webrtc::AudioReceiveStream {
|
|||||||
const webrtc::AudioReceiveStream::Config& config);
|
const webrtc::AudioReceiveStream::Config& config);
|
||||||
~AudioReceiveStream() override {}
|
~AudioReceiveStream() override {}
|
||||||
|
|
||||||
|
webrtc::AudioReceiveStream::Stats GetStats() const override;
|
||||||
|
|
||||||
bool DeliverRtcp(const uint8_t* packet, size_t length);
|
bool DeliverRtcp(const uint8_t* packet, size_t length);
|
||||||
bool DeliverRtp(const uint8_t* packet, size_t length);
|
bool DeliverRtp(const uint8_t* packet, size_t length);
|
||||||
|
|
||||||
|
@ -72,6 +72,10 @@ class Call : public webrtc::Call, public PacketReceiver {
|
|||||||
|
|
||||||
PacketReceiver* Receiver() override;
|
PacketReceiver* Receiver() override;
|
||||||
|
|
||||||
|
webrtc::AudioSendStream* CreateAudioSendStream(
|
||||||
|
const webrtc::AudioSendStream::Config& config) override;
|
||||||
|
void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override;
|
||||||
|
|
||||||
webrtc::AudioReceiveStream* CreateAudioReceiveStream(
|
webrtc::AudioReceiveStream* CreateAudioReceiveStream(
|
||||||
const webrtc::AudioReceiveStream::Config& config) override;
|
const webrtc::AudioReceiveStream::Config& config) override;
|
||||||
void DestroyAudioReceiveStream(
|
void DestroyAudioReceiveStream(
|
||||||
@ -196,6 +200,14 @@ Call::~Call() {
|
|||||||
|
|
||||||
PacketReceiver* Call::Receiver() { return this; }
|
PacketReceiver* Call::Receiver() { return this; }
|
||||||
|
|
||||||
|
webrtc::AudioSendStream* Call::CreateAudioSendStream(
|
||||||
|
const webrtc::AudioSendStream::Config& config) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) {
|
||||||
|
}
|
||||||
|
|
||||||
webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
|
webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
|
||||||
const webrtc::AudioReceiveStream::Config& config) {
|
const webrtc::AudioReceiveStream::Config& config) {
|
||||||
TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
|
TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream");
|
||||||
|
Reference in New Issue
Block a user