Replace scoped_ptr with unique_ptr in webrtc/audio/
BUG=webrtc:5520 Review URL: https://codereview.webrtc.org/1706183002 Cr-Commit-Position: refs/heads/master@{#11723}
This commit is contained in:
@ -93,8 +93,7 @@ AudioReceiveStream::AudioReceiveStream(
|
||||
RTC_DCHECK(rtp_header_parser_);
|
||||
|
||||
VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
|
||||
channel_proxy_ =
|
||||
rtc::UniqueToScoped(voe_impl->GetChannelProxy(config_.voe_channel_id));
|
||||
channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
|
||||
channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc);
|
||||
for (const auto& extension : config.rtp.extensions) {
|
||||
if (extension.name == RtpExtension::kAudioLevel) {
|
||||
@ -229,9 +228,9 @@ webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const {
|
||||
return stats;
|
||||
}
|
||||
|
||||
void AudioReceiveStream::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) {
|
||||
void AudioReceiveStream::SetSink(std::unique_ptr<AudioSinkInterface> sink) {
|
||||
RTC_DCHECK(thread_checker_.CalledOnValidThread());
|
||||
channel_proxy_->SetSink(rtc::ScopedToUnique(std::move(sink)));
|
||||
channel_proxy_->SetSink(std::move(sink));
|
||||
}
|
||||
|
||||
const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const {
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_
|
||||
#define WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/audio_receive_stream.h"
|
||||
#include "webrtc/audio_state.h"
|
||||
#include "webrtc/base/thread_checker.h"
|
||||
@ -45,7 +47,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(std::unique_ptr<AudioSinkInterface> sink) override;
|
||||
|
||||
const webrtc::AudioReceiveStream::Config& config() const;
|
||||
|
||||
@ -56,8 +58,8 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream {
|
||||
RemoteBitrateEstimator* remote_bitrate_estimator_ = nullptr;
|
||||
const webrtc::AudioReceiveStream::Config config_;
|
||||
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
|
||||
rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_;
|
||||
rtc::scoped_ptr<voe::ChannelProxy> channel_proxy_;
|
||||
std::unique_ptr<RtpHeaderParser> rtp_header_parser_;
|
||||
std::unique_ptr<voe::ChannelProxy> channel_proxy_;
|
||||
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream);
|
||||
};
|
||||
|
||||
@ -67,8 +67,7 @@ AudioSendStream::AudioSendStream(
|
||||
RTC_DCHECK(congestion_controller);
|
||||
|
||||
VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
|
||||
channel_proxy_ =
|
||||
rtc::UniqueToScoped(voe_impl->GetChannelProxy(config_.voe_channel_id));
|
||||
channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
|
||||
channel_proxy_->RegisterSenderCongestionControlObjects(
|
||||
congestion_controller->pacer(),
|
||||
congestion_controller->GetTransportFeedbackObserver(),
|
||||
|
||||
@ -11,10 +11,11 @@
|
||||
#ifndef WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_
|
||||
#define WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/audio_send_stream.h"
|
||||
#include "webrtc/audio_state.h"
|
||||
#include "webrtc/base/thread_checker.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
|
||||
namespace webrtc {
|
||||
class CongestionController;
|
||||
@ -51,7 +52,7 @@ class AudioSendStream final : public webrtc::AudioSendStream {
|
||||
rtc::ThreadChecker thread_checker_;
|
||||
const webrtc::AudioSendStream::Config config_;
|
||||
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
|
||||
rtc::scoped_ptr<voe::ChannelProxy> channel_proxy_;
|
||||
std::unique_ptr<voe::ChannelProxy> channel_proxy_;
|
||||
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream);
|
||||
};
|
||||
|
||||
@ -8,10 +8,11 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
#include "webrtc/audio/audio_state.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/test/mock_voice_engine.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -44,20 +45,20 @@ TEST(AudioStateTest, Create) {
|
||||
|
||||
TEST(AudioStateTest, ConstructDestruct) {
|
||||
ConfigHelper helper;
|
||||
rtc::scoped_ptr<internal::AudioState> audio_state(
|
||||
std::unique_ptr<internal::AudioState> audio_state(
|
||||
new internal::AudioState(helper.config()));
|
||||
}
|
||||
|
||||
TEST(AudioStateTest, GetVoiceEngine) {
|
||||
ConfigHelper helper;
|
||||
rtc::scoped_ptr<internal::AudioState> audio_state(
|
||||
std::unique_ptr<internal::AudioState> audio_state(
|
||||
new internal::AudioState(helper.config()));
|
||||
EXPECT_EQ(audio_state->voice_engine(), &helper.voice_engine());
|
||||
}
|
||||
|
||||
TEST(AudioStateTest, TypingNoiseDetected) {
|
||||
ConfigHelper helper;
|
||||
rtc::scoped_ptr<internal::AudioState> audio_state(
|
||||
std::unique_ptr<internal::AudioState> audio_state(
|
||||
new internal::AudioState(helper.config()));
|
||||
VoiceEngineObserver* voe_observer =
|
||||
static_cast<VoiceEngineObserver*>(audio_state.get());
|
||||
|
||||
@ -12,10 +12,10 @@
|
||||
#define WEBRTC_AUDIO_RECEIVE_STREAM_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/config.h"
|
||||
#include "webrtc/stream.h"
|
||||
#include "webrtc/transport.h"
|
||||
@ -114,7 +114,7 @@ class AudioReceiveStream : public ReceiveStream {
|
||||
// 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(std::unique_ptr<AudioSinkInterface> sink) = 0;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
@ -76,8 +76,8 @@ webrtc::AudioReceiveStream::Stats FakeAudioReceiveStream::GetStats() const {
|
||||
}
|
||||
|
||||
void FakeAudioReceiveStream::SetSink(
|
||||
rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) {
|
||||
sink_ = std::move(sink);
|
||||
std::unique_ptr<webrtc::AudioSinkInterface> sink) {
|
||||
sink_ = rtc::UniqueToScoped(std::move(sink));
|
||||
}
|
||||
|
||||
FakeVideoSendStream::FakeVideoSendStream(
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_
|
||||
#define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/audio_receive_stream.h"
|
||||
@ -90,7 +91,7 @@ class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream {
|
||||
|
||||
// webrtc::AudioReceiveStream implementation.
|
||||
webrtc::AudioReceiveStream::Stats GetStats() const override;
|
||||
void SetSink(rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) override;
|
||||
void SetSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) override;
|
||||
|
||||
webrtc::AudioReceiveStream::Config config_;
|
||||
webrtc::AudioReceiveStream::Stats stats_;
|
||||
|
||||
@ -1338,7 +1338,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream {
|
||||
|
||||
void SetRawAudioSink(rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) {
|
||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||
stream_->SetSink(std::move(sink));
|
||||
stream_->SetSink(rtc::ScopedToUnique(std::move(sink)));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user