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

Side by Side Diff: media/cast/sender/audio_sender.cc

Issue 1905763002: Convert //media/cast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « media/cast/sender/audio_sender.h ('k') | media/cast/sender/audio_sender_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/cast/sender/audio_sender.h" 5 #include "media/cast/sender/audio_sender.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 transport_sender->InitializeAudio( 70 transport_sender->InitializeAudio(
71 transport_config, base::Bind(&AudioSender::OnReceivedCastFeedback, 71 transport_config, base::Bind(&AudioSender::OnReceivedCastFeedback,
72 weak_factory_.GetWeakPtr()), 72 weak_factory_.GetWeakPtr()),
73 base::Bind(&AudioSender::OnMeasuredRoundTripTime, 73 base::Bind(&AudioSender::OnMeasuredRoundTripTime,
74 weak_factory_.GetWeakPtr()), 74 weak_factory_.GetWeakPtr()),
75 base::Bind(&AudioSender::OnReceivedPli, weak_factory_.GetWeakPtr())); 75 base::Bind(&AudioSender::OnReceivedPli, weak_factory_.GetWeakPtr()));
76 } 76 }
77 77
78 AudioSender::~AudioSender() {} 78 AudioSender::~AudioSender() {}
79 79
80 void AudioSender::InsertAudio(scoped_ptr<AudioBus> audio_bus, 80 void AudioSender::InsertAudio(std::unique_ptr<AudioBus> audio_bus,
81 const base::TimeTicks& recorded_time) { 81 const base::TimeTicks& recorded_time) {
82 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 82 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
83 83
84 if (!audio_encoder_) { 84 if (!audio_encoder_) {
85 NOTREACHED(); 85 NOTREACHED();
86 return; 86 return;
87 } 87 }
88 88
89 const base::TimeDelta next_frame_duration = 89 const base::TimeDelta next_frame_duration =
90 RtpTimeDelta::FromTicks(audio_bus->frames()).ToTimeDelta(rtp_timebase()); 90 RtpTimeDelta::FromTicks(audio_bus->frames()).ToTimeDelta(rtp_timebase());
(...skipping 12 matching lines...) Expand all
103 } 103 }
104 104
105 base::TimeDelta AudioSender::GetInFlightMediaDuration() const { 105 base::TimeDelta AudioSender::GetInFlightMediaDuration() const {
106 const int samples_in_flight = samples_in_encoder_ + 106 const int samples_in_flight = samples_in_encoder_ +
107 GetUnacknowledgedFrameCount() * audio_encoder_->GetSamplesPerFrame(); 107 GetUnacknowledgedFrameCount() * audio_encoder_->GetSamplesPerFrame();
108 return RtpTimeDelta::FromTicks(samples_in_flight).ToTimeDelta(rtp_timebase()); 108 return RtpTimeDelta::FromTicks(samples_in_flight).ToTimeDelta(rtp_timebase());
109 } 109 }
110 110
111 void AudioSender::OnEncodedAudioFrame( 111 void AudioSender::OnEncodedAudioFrame(
112 int encoder_bitrate, 112 int encoder_bitrate,
113 scoped_ptr<SenderEncodedFrame> encoded_frame, 113 std::unique_ptr<SenderEncodedFrame> encoded_frame,
114 int samples_skipped) { 114 int samples_skipped) {
115 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 115 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
116 116
117 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped; 117 samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped;
118 DCHECK_GE(samples_in_encoder_, 0); 118 DCHECK_GE(samples_in_encoder_, 0);
119 119
120 SendEncodedFrame(encoder_bitrate, std::move(encoded_frame)); 120 SendEncodedFrame(encoder_bitrate, std::move(encoded_frame));
121 } 121 }
122 122
123 } // namespace cast 123 } // namespace cast
124 } // namespace media 124 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/audio_sender.h ('k') | media/cast/sender/audio_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698