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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 1702983002: Replace scoped_ptr with unique_ptr in webrtc/voice_engine/ (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 unified diff | Download patch
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 _voiceEngineObserverPtr = voiceEngineObserver; 1064 _voiceEngineObserverPtr = voiceEngineObserver;
1065 _callbackCritSectPtr = callbackCritSect; 1065 _callbackCritSectPtr = callbackCritSect;
1066 return 0; 1066 return 0;
1067 } 1067 }
1068 1068
1069 int32_t Channel::UpdateLocalTimeStamp() { 1069 int32_t Channel::UpdateLocalTimeStamp() {
1070 _timeStamp += static_cast<uint32_t>(_audioFrame.samples_per_channel_); 1070 _timeStamp += static_cast<uint32_t>(_audioFrame.samples_per_channel_);
1071 return 0; 1071 return 0;
1072 } 1072 }
1073 1073
1074 void Channel::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) { 1074 void Channel::SetSink(std::unique_ptr<AudioSinkInterface> sink) {
1075 rtc::CritScope cs(&_callbackCritSect); 1075 rtc::CritScope cs(&_callbackCritSect);
1076 audio_sink_ = std::move(sink); 1076 audio_sink_ = std::move(sink);
1077 } 1077 }
1078 1078
1079 int32_t Channel::StartPlayout() { 1079 int32_t Channel::StartPlayout() {
1080 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 1080 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1081 "Channel::StartPlayout()"); 1081 "Channel::StartPlayout()");
1082 if (channel_state_.Get().playing) { 1082 if (channel_state_.Get().playing) {
1083 return 0; 1083 return 0;
1084 } 1084 }
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
3258 int Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, 3258 int Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule,
3259 RtpReceiver** rtp_receiver) const { 3259 RtpReceiver** rtp_receiver) const {
3260 *rtpRtcpModule = _rtpRtcpModule.get(); 3260 *rtpRtcpModule = _rtpRtcpModule.get();
3261 *rtp_receiver = rtp_receiver_.get(); 3261 *rtp_receiver = rtp_receiver_.get();
3262 return 0; 3262 return 0;
3263 } 3263 }
3264 3264
3265 // TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use 3265 // TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use
3266 // a shared helper. 3266 // a shared helper.
3267 int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) { 3267 int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) {
3268 rtc::scoped_ptr<int16_t[]> fileBuffer(new int16_t[640]); 3268 std::unique_ptr<int16_t[]> fileBuffer(new int16_t[640]);
3269 size_t fileSamples(0); 3269 size_t fileSamples(0);
3270 3270
3271 { 3271 {
3272 rtc::CritScope cs(&_fileCritSect); 3272 rtc::CritScope cs(&_fileCritSect);
3273 3273
3274 if (_inputFilePlayerPtr == NULL) { 3274 if (_inputFilePlayerPtr == NULL) {
3275 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), 3275 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
3276 "Channel::MixOrReplaceAudioWithFile() fileplayer" 3276 "Channel::MixOrReplaceAudioWithFile() fileplayer"
3277 " doesnt exist"); 3277 " doesnt exist");
3278 return -1; 3278 return -1;
(...skipping 27 matching lines...) Expand all
3306 _audioFrame.UpdateFrame( 3306 _audioFrame.UpdateFrame(
3307 _channelId, 0xFFFFFFFF, fileBuffer.get(), fileSamples, mixingFrequency, 3307 _channelId, 0xFFFFFFFF, fileBuffer.get(), fileSamples, mixingFrequency,
3308 AudioFrame::kNormalSpeech, AudioFrame::kVadUnknown, 1); 3308 AudioFrame::kNormalSpeech, AudioFrame::kVadUnknown, 1);
3309 } 3309 }
3310 return 0; 3310 return 0;
3311 } 3311 }
3312 3312
3313 int32_t Channel::MixAudioWithFile(AudioFrame& audioFrame, int mixingFrequency) { 3313 int32_t Channel::MixAudioWithFile(AudioFrame& audioFrame, int mixingFrequency) {
3314 assert(mixingFrequency <= 48000); 3314 assert(mixingFrequency <= 48000);
3315 3315
3316 rtc::scoped_ptr<int16_t[]> fileBuffer(new int16_t[960]); 3316 std::unique_ptr<int16_t[]> fileBuffer(new int16_t[960]);
3317 size_t fileSamples(0); 3317 size_t fileSamples(0);
3318 3318
3319 { 3319 {
3320 rtc::CritScope cs(&_fileCritSect); 3320 rtc::CritScope cs(&_fileCritSect);
3321 3321
3322 if (_outputFilePlayerPtr == NULL) { 3322 if (_outputFilePlayerPtr == NULL) {
3323 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), 3323 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId),
3324 "Channel::MixAudioWithFile() file mixing failed"); 3324 "Channel::MixAudioWithFile() file mixing failed");
3325 return -1; 3325 return -1;
3326 } 3326 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
3650 int64_t min_rtt = 0; 3650 int64_t min_rtt = 0;
3651 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3651 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3652 0) { 3652 0) {
3653 return 0; 3653 return 0;
3654 } 3654 }
3655 return rtt; 3655 return rtt;
3656 } 3656 }
3657 3657
3658 } // namespace voe 3658 } // namespace voe
3659 } // namespace webrtc 3659 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698