diff options
author | deadbeef <deadbeef@webrtc.org> | 2016-01-12 16:44:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-13 00:45:33 +0000 |
commit | e591f9377f33f3f725a30faecd1bef1a71fa6b99 (patch) | |
tree | d645f0268ff6a66c49a5c48d9351494455b28dee /webrtc | |
parent | 6955870806624479723addfae6dcf5d13968796c (diff) | |
download | webrtc-e591f9377f33f3f725a30faecd1bef1a71fa6b99.tar.gz |
Storing raw audio sink for default audio track.
BUG=webrtc:5250
Review URL: https://codereview.webrtc.org/1551813002
Cr-Commit-Position: refs/heads/master@{#11230}
Diffstat (limited to 'webrtc')
-rw-r--r-- | webrtc/audio/audio_receive_stream.cc | 5 | ||||
-rw-r--r-- | webrtc/audio/audio_receive_stream.h | 2 | ||||
-rw-r--r-- | webrtc/audio/audio_sink.h | 4 | ||||
-rw-r--r-- | webrtc/audio_receive_stream.h | 6 | ||||
-rw-r--r-- | webrtc/voice_engine/channel.cc | 4 | ||||
-rw-r--r-- | webrtc/voice_engine/channel.h | 5 | ||||
-rw-r--r-- | webrtc/voice_engine/channel_proxy.cc | 4 | ||||
-rw-r--r-- | webrtc/voice_engine/channel_proxy.h | 3 |
8 files changed, 19 insertions, 14 deletions
diff --git a/webrtc/audio/audio_receive_stream.cc b/webrtc/audio/audio_receive_stream.cc index 64d008326d..8b31130554 100644 --- a/webrtc/audio/audio_receive_stream.cc +++ b/webrtc/audio/audio_receive_stream.cc @@ -235,9 +235,10 @@ webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const { return stats; } -void AudioReceiveStream::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) { +void AudioReceiveStream::SetSink( + const rtc::scoped_refptr<AudioSinkInterface>& sink) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - channel_proxy_->SetSink(std::move(sink)); + channel_proxy_->SetSink(sink); } const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { diff --git a/webrtc/audio/audio_receive_stream.h b/webrtc/audio/audio_receive_stream.h index 4940c6a64c..7a070be2e0 100644 --- a/webrtc/audio/audio_receive_stream.h +++ b/webrtc/audio/audio_receive_stream.h @@ -45,7 +45,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream { // webrtc::AudioReceiveStream implementation. webrtc::AudioReceiveStream::Stats GetStats() const override; - void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) override; + void SetSink(const rtc::scoped_refptr<AudioSinkInterface>& sink) override; const webrtc::AudioReceiveStream::Config& config() const; diff --git a/webrtc/audio/audio_sink.h b/webrtc/audio/audio_sink.h index 999644f4ce..50ce7a109a 100644 --- a/webrtc/audio/audio_sink.h +++ b/webrtc/audio/audio_sink.h @@ -19,10 +19,12 @@ #include <inttypes.h> #include <stddef.h> +#include "webrtc/base/refcount.h" + namespace webrtc { // Represents a simple push audio sink. -class AudioSinkInterface { +class AudioSinkInterface : public rtc::RefCountInterface { public: virtual ~AudioSinkInterface() {} diff --git a/webrtc/audio_receive_stream.h b/webrtc/audio_receive_stream.h index 8cab094f4b..062aedb43e 100644 --- a/webrtc/audio_receive_stream.h +++ b/webrtc/audio_receive_stream.h @@ -15,7 +15,7 @@ #include <string> #include <vector> -#include "webrtc/base/scoped_ptr.h" +#include "webrtc/base/scoped_ref_ptr.h" #include "webrtc/config.h" #include "webrtc/stream.h" #include "webrtc/transport.h" @@ -112,12 +112,12 @@ class AudioReceiveStream : public ReceiveStream { // 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. + // 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; + virtual void SetSink(const rtc::scoped_refptr<AudioSinkInterface>& sink) = 0; }; } // namespace webrtc diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index b1b55e8acc..de7d13a10f 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -1185,9 +1185,9 @@ Channel::UpdateLocalTimeStamp() return 0; } -void Channel::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) { +void Channel::SetSink(const rtc::scoped_refptr<AudioSinkInterface>& sink) { CriticalSectionScoped cs(&_callbackCritSect); - audio_sink_ = std::move(sink); + audio_sink_ = sink; } int32_t diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h index d15f9dbca7..771b3c43ec 100644 --- a/webrtc/voice_engine/channel.h +++ b/webrtc/voice_engine/channel.h @@ -14,6 +14,7 @@ #include "webrtc/audio/audio_sink.h" #include "webrtc/base/criticalsection.h" #include "webrtc/base/scoped_ptr.h" +#include "webrtc/base/scoped_ref_ptr.h" #include "webrtc/common_audio/resampler/include/push_resampler.h" #include "webrtc/common_types.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h" @@ -193,7 +194,7 @@ public: CriticalSectionWrapper* callbackCritSect); int32_t UpdateLocalTimeStamp(); - void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink); + void SetSink(const rtc::scoped_refptr<AudioSinkInterface>& sink); // API methods @@ -511,7 +512,7 @@ private: TelephoneEventHandler* telephone_event_handler_; rtc::scoped_ptr<RtpRtcp> _rtpRtcpModule; rtc::scoped_ptr<AudioCodingModule> audio_coding_; - rtc::scoped_ptr<AudioSinkInterface> audio_sink_; + rtc::scoped_refptr<AudioSinkInterface> audio_sink_; AudioLevel _outputAudioLevel; bool _externalTransport; AudioFrame _audioFrame; diff --git a/webrtc/voice_engine/channel_proxy.cc b/webrtc/voice_engine/channel_proxy.cc index f54c81ec47..711f2abd03 100644 --- a/webrtc/voice_engine/channel_proxy.cc +++ b/webrtc/voice_engine/channel_proxy.cc @@ -139,9 +139,9 @@ bool ChannelProxy::SendTelephoneEventOutband(uint8_t event, channel()->SendTelephoneEventOutband(event, duration_ms, 10, false) == 0; } -void ChannelProxy::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) { +void ChannelProxy::SetSink(const rtc::scoped_refptr<AudioSinkInterface>& sink) { RTC_DCHECK(thread_checker_.CalledOnValidThread()); - channel()->SetSink(std::move(sink)); + channel()->SetSink(sink); } Channel* ChannelProxy::channel() const { diff --git a/webrtc/voice_engine/channel_proxy.h b/webrtc/voice_engine/channel_proxy.h index b990d91734..ba206cb8bc 100644 --- a/webrtc/voice_engine/channel_proxy.h +++ b/webrtc/voice_engine/channel_proxy.h @@ -11,6 +11,7 @@ #ifndef WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_ #define WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_ +#include "webrtc/base/scoped_ref_ptr.h" #include "webrtc/base/thread_checker.h" #include "webrtc/voice_engine/channel_manager.h" #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" @@ -65,7 +66,7 @@ class ChannelProxy { virtual bool SetSendTelephoneEventPayloadType(int payload_type); virtual bool SendTelephoneEventOutband(uint8_t event, uint32_t duration_ms); - virtual void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink); + virtual void SetSink(const rtc::scoped_refptr<AudioSinkInterface>& sink); private: Channel* channel() const; |