Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc

Issue 1696853004: Replace scoped_ptr with unique_ptr in webrtc/modules/audio_coding/codecs/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
diff --git a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
index 180166c40cab7c229575073c7d8d8d60e054f29d..464655c511d349bb5bd2c74c21a15386c607059c 100644
--- a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
+++ b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
@@ -11,6 +11,7 @@
#include "webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.h"
#include <algorithm>
+#include <memory>
#include <limits>
namespace webrtc {
@@ -19,12 +20,13 @@ namespace {
const int kMaxFrameSizeMs = 60;
-rtc::scoped_ptr<CNG_enc_inst, CngInstDeleter> CreateCngInst(
+std::unique_ptr<CNG_enc_inst, CngInstDeleter> CreateCngInst(
int sample_rate_hz,
int sid_frame_interval_ms,
int num_cng_coefficients) {
- rtc::scoped_ptr<CNG_enc_inst, CngInstDeleter> cng_inst;
- RTC_CHECK_EQ(0, WebRtcCng_CreateEnc(cng_inst.accept()));
+ CNG_enc_inst* ci;
+ RTC_CHECK_EQ(0, WebRtcCng_CreateEnc(&ci));
tommi 2016/02/14 09:08:37 I wish unique_ptr had better support for accepting
kwiberg-webrtc 2016/02/14 13:07:43 Yes, but this may very well be deliberate: any pla
+ std::unique_ptr<CNG_enc_inst, CngInstDeleter> cng_inst(ci);
RTC_CHECK_EQ(0,
WebRtcCng_InitEnc(cng_inst.get(), sample_rate_hz,
sid_frame_interval_ms, num_cng_coefficients));
@@ -55,7 +57,7 @@ AudioEncoderCng::AudioEncoderCng(const Config& config)
num_cng_coefficients_(config.num_cng_coefficients),
sid_frame_interval_ms_(config.sid_frame_interval_ms),
last_frame_active_(true),
- vad_(config.vad ? rtc_make_scoped_ptr(config.vad)
+ vad_(config.vad ? std::unique_ptr<Vad>(config.vad)
: CreateVad(config.vad_mode)) {
RTC_CHECK(config.IsOk()) << "Invalid configuration.";
cng_inst_ = CreateCngInst(SampleRateHz(), sid_frame_interval_ms_,

Powered by Google App Engine
This is Rietveld 408576698