-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Probably not necessary but a diff when running a step in build.sh
- Loading branch information
Showing
12 changed files
with
1,326 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* libjingle | ||
* Copyright 2015 Google Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* 3. The name of the author may not be used to endorse or promote products | ||
* derived from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef TALK_APP_WEBRTC_MEDIASTREAMOBSERVER_H_ | ||
#define TALK_APP_WEBRTC_MEDIASTREAMOBSERVER_H_ | ||
|
||
#include "talk/app/webrtc/mediastreaminterface.h" | ||
#include "webrtc/base/scoped_ref_ptr.h" | ||
#include "webrtc/base/sigslot.h" | ||
|
||
namespace webrtc { | ||
|
||
// Helper class which will listen for changes to a stream and emit the | ||
// corresponding signals. | ||
class MediaStreamObserver : public ObserverInterface { | ||
public: | ||
explicit MediaStreamObserver(MediaStreamInterface* stream); | ||
~MediaStreamObserver(); | ||
|
||
const MediaStreamInterface* stream() const { return stream_; } | ||
|
||
void OnChanged() override; | ||
|
||
sigslot::signal2<AudioTrackInterface*, MediaStreamInterface*> | ||
SignalAudioTrackAdded; | ||
sigslot::signal2<AudioTrackInterface*, MediaStreamInterface*> | ||
SignalAudioTrackRemoved; | ||
sigslot::signal2<VideoTrackInterface*, MediaStreamInterface*> | ||
SignalVideoTrackAdded; | ||
sigslot::signal2<VideoTrackInterface*, MediaStreamInterface*> | ||
SignalVideoTrackRemoved; | ||
|
||
private: | ||
rtc::scoped_refptr<MediaStreamInterface> stream_; | ||
AudioTrackVector cached_audio_tracks_; | ||
VideoTrackVector cached_video_tracks_; | ||
}; | ||
|
||
} // namespace webrtc | ||
|
||
#endif // TALK_APP_WEBRTC_MEDIASTREAMOBSERVER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* libjingle | ||
* Copyright 2015 Google Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* 3. The name of the author may not be used to endorse or promote products | ||
* derived from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
// TODO(tommi): Delete this file when removed from build files in Chromium. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
* 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_RECEIVE_STREAM_H_ | ||
#define WEBRTC_AUDIO_RECEIVE_STREAM_H_ | ||
|
||
#include <map> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "webrtc/base/scoped_ptr.h" | ||
#include "webrtc/config.h" | ||
#include "webrtc/stream.h" | ||
#include "webrtc/transport.h" | ||
#include "webrtc/typedefs.h" | ||
|
||
namespace webrtc { | ||
|
||
class AudioDecoder; | ||
class AudioSinkInterface; | ||
|
||
// WORK IN PROGRESS | ||
// This class is under development and is not yet intended for for use outside | ||
// of WebRtc/Libjingle. Please use the VoiceEngine API instead. | ||
// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690 | ||
|
||
class AudioReceiveStream : public ReceiveStream { | ||
public: | ||
struct Stats { | ||
uint32_t remote_ssrc = 0; | ||
int64_t bytes_rcvd = 0; | ||
uint32_t packets_rcvd = 0; | ||
uint32_t packets_lost = 0; | ||
float fraction_lost = 0.0f; | ||
std::string codec_name; | ||
uint32_t ext_seqnum = 0; | ||
uint32_t jitter_ms = 0; | ||
uint32_t jitter_buffer_ms = 0; | ||
uint32_t jitter_buffer_preferred_ms = 0; | ||
uint32_t delay_estimate_ms = 0; | ||
int32_t audio_level = -1; | ||
float expand_rate = 0.0f; | ||
float speech_expand_rate = 0.0f; | ||
float secondary_decoded_rate = 0.0f; | ||
float accelerate_rate = 0.0f; | ||
float preemptive_expand_rate = 0.0f; | ||
int32_t decoding_calls_to_silence_generator = 0; | ||
int32_t decoding_calls_to_neteq = 0; | ||
int32_t decoding_normal = 0; | ||
int32_t decoding_plc = 0; | ||
int32_t decoding_cng = 0; | ||
int32_t decoding_plc_cng = 0; | ||
int64_t capture_start_ntp_time_ms = 0; | ||
}; | ||
|
||
struct Config { | ||
std::string ToString() const; | ||
|
||
// Receive-stream specific RTP settings. | ||
struct Rtp { | ||
std::string ToString() const; | ||
|
||
// Synchronization source (stream identifier) to be received. | ||
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. | ||
std::vector<RtpExtension> extensions; | ||
} rtp; | ||
|
||
Transport* receive_transport = nullptr; | ||
Transport* rtcp_send_transport = nullptr; | ||
|
||
// Underlying VoiceEngine handle, used to map AudioReceiveStream to lower- | ||
// level components. | ||
// TODO(solenberg): Remove when VoiceEngine channels are created outside | ||
// of Call. | ||
int voe_channel_id = -1; | ||
|
||
// Identifier for an A/V synchronization group. Empty string to disable. | ||
// TODO(pbos): Synchronize streams in a sync group, not just one video | ||
// stream to one audio stream. Tracked by issue webrtc:4762. | ||
std::string sync_group; | ||
|
||
// 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; | ||
|
||
// TODO(pbos): Remove config option once combined A/V BWE is always on. | ||
bool combined_audio_video_bwe = false; | ||
}; | ||
|
||
virtual Stats GetStats() const = 0; | ||
|
||
// Sets an audio sink that receives unmixed audio from the receive stream. | ||
// Ownership of the sink is passed to the stream and can be used by the | ||
// caller to do lifetime management (i.e. when the sink's dtor is called). | ||
// Only one sink can be set and passing a null sink, clears an existing one. | ||
// NOTE: Audio must still somehow be pulled through AudioTransport for audio | ||
// to stream through this sink. In practice, this happens if mixed audio | ||
// is being pulled+rendered and/or if audio is being pulled for the purposes | ||
// of feeding to the AEC. | ||
virtual void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) = 0; | ||
}; | ||
} // namespace webrtc | ||
|
||
#endif // WEBRTC_AUDIO_RECEIVE_STREAM_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* 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/stream.h" | ||
#include "webrtc/transport.h" | ||
#include "webrtc/typedefs.h" | ||
|
||
namespace webrtc { | ||
|
||
// WORK IN PROGRESS | ||
// This class is under development and is not yet intended for for use outside | ||
// of WebRtc/Libjingle. Please use the VoiceEngine API instead. | ||
// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690 | ||
|
||
class AudioSendStream : public SendStream { | ||
public: | ||
struct Stats { | ||
// TODO(solenberg): Harmonize naming and defaults with receive stream stats. | ||
uint32_t local_ssrc = 0; | ||
int64_t bytes_sent = 0; | ||
int32_t packets_sent = 0; | ||
int32_t packets_lost = -1; | ||
float fraction_lost = -1.0f; | ||
std::string codec_name; | ||
int32_t ext_seqnum = -1; | ||
int32_t jitter_ms = -1; | ||
int64_t rtt_ms = -1; | ||
int32_t audio_level = -1; | ||
float aec_quality_min = -1.0f; | ||
int32_t echo_delay_median_ms = -1; | ||
int32_t echo_delay_std_ms = -1; | ||
int32_t echo_return_loss = -100; | ||
int32_t echo_return_loss_enhancement = -100; | ||
bool typing_noise_detected = false; | ||
}; | ||
|
||
struct Config { | ||
Config() = delete; | ||
explicit Config(Transport* send_transport) | ||
: send_transport(send_transport) {} | ||
|
||
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 sent stream. | ||
std::vector<RtpExtension> extensions; | ||
|
||
// RTCP CNAME, see RFC 3550. | ||
std::string c_name; | ||
} rtp; | ||
|
||
// Transport for outgoing packets. The transport is expected to exist for | ||
// the entire life of the AudioSendStream and is owned by the API client. | ||
Transport* send_transport = nullptr; | ||
|
||
// Underlying VoiceEngine handle, used to map AudioSendStream to lower-level | ||
// components. | ||
// TODO(solenberg): Remove when VoiceEngine channels are created outside | ||
// of Call. | ||
int voe_channel_id = -1; | ||
|
||
// Ownership of the encoder object is transferred to Call when the config is | ||
// passed to Call::CreateAudioSendStream(). | ||
// TODO(solenberg): Implement, once we configure codecs through the new API. | ||
// 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. | ||
}; | ||
|
||
// TODO(solenberg): Make payload_type a config property instead. | ||
virtual bool SendTelephoneEvent(int payload_type, uint8_t event, | ||
uint32_t duration_ms) = 0; | ||
virtual Stats GetStats() const = 0; | ||
}; | ||
} // namespace webrtc | ||
|
||
#endif // WEBRTC_AUDIO_SEND_STREAM_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2013 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_FRAME_CALLBACK_H_ | ||
#define WEBRTC_FRAME_CALLBACK_H_ | ||
|
||
#include <stddef.h> | ||
|
||
#include "webrtc/common_types.h" | ||
|
||
namespace webrtc { | ||
|
||
class VideoFrame; | ||
|
||
struct EncodedFrame { | ||
public: | ||
EncodedFrame() : data_(NULL), length_(0), frame_type_(kEmptyFrame) {} | ||
EncodedFrame(const uint8_t* data, size_t length, FrameType frame_type) | ||
: data_(data), length_(length), frame_type_(frame_type) {} | ||
|
||
const uint8_t* data_; | ||
const size_t length_; | ||
const FrameType frame_type_; | ||
}; | ||
|
||
class I420FrameCallback { | ||
public: | ||
// This function is called with a I420 frame allowing the user to modify the | ||
// frame content. | ||
virtual void FrameCallback(VideoFrame* video_frame) = 0; | ||
|
||
protected: | ||
virtual ~I420FrameCallback() {} | ||
}; | ||
|
||
class EncodedFrameObserver { | ||
public: | ||
virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) = 0; | ||
|
||
protected: | ||
virtual ~EncodedFrameObserver() {} | ||
}; | ||
|
||
} // namespace webrtc | ||
|
||
#endif // WEBRTC_FRAME_CALLBACK_H_ |
Oops, something went wrong.
5d5a74c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did trim down some of the includes, pretty sure these aren't necessary :)
(And they definitely won't be once we have the non media'd libwebrtc)
5d5a74c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok, this'll all get cleaned up with #23 anyways.