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

Side by Side Diff: chromecast/media/cma/backend/alsa/stream_mixer_alsa.cc

Issue 1875623002: Convert //chromecast 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chromecast/media/cma/backend/alsa/stream_mixer_alsa.h" 5 #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 pcm_ = nullptr; 539 pcm_ = nullptr;
540 } 540 }
541 541
542 void StreamMixerAlsa::SignalError() { 542 void StreamMixerAlsa::SignalError() {
543 state_ = kStateError; 543 state_ = kStateError;
544 for (InputQueue* input : inputs_) 544 for (InputQueue* input : inputs_)
545 input->SignalError(); 545 input->SignalError();
546 } 546 }
547 547
548 void StreamMixerAlsa::SetAlsaWrapperForTest( 548 void StreamMixerAlsa::SetAlsaWrapperForTest(
549 scoped_ptr<AlsaWrapper> alsa_wrapper) { 549 std::unique_ptr<AlsaWrapper> alsa_wrapper) {
550 if (alsa_) { 550 if (alsa_) {
551 Stop(); 551 Stop();
552 ClosePcm(); 552 ClosePcm();
553 } 553 }
554 alsa_ = std::move(alsa_wrapper); 554 alsa_ = std::move(alsa_wrapper);
555 } 555 }
556 556
557 void StreamMixerAlsa::WriteFramesForTest() { 557 void StreamMixerAlsa::WriteFramesForTest() {
558 RUN_ON_MIXER_THREAD(&StreamMixerAlsa::WriteFramesForTest); 558 RUN_ON_MIXER_THREAD(&StreamMixerAlsa::WriteFramesForTest);
559 WriteFrames(); 559 WriteFrames();
560 } 560 }
561 561
562 void StreamMixerAlsa::ClearInputsForTest() { 562 void StreamMixerAlsa::ClearInputsForTest() {
563 RUN_ON_MIXER_THREAD(&StreamMixerAlsa::ClearInputsForTest); 563 RUN_ON_MIXER_THREAD(&StreamMixerAlsa::ClearInputsForTest);
564 inputs_.clear(); 564 inputs_.clear();
565 } 565 }
566 566
567 void StreamMixerAlsa::AddInput(scoped_ptr<InputQueue> input) { 567 void StreamMixerAlsa::AddInput(std::unique_ptr<InputQueue> input) {
568 RUN_ON_MIXER_THREAD(&StreamMixerAlsa::AddInput, 568 RUN_ON_MIXER_THREAD(&StreamMixerAlsa::AddInput,
569 base::Passed(std::move(input))); 569 base::Passed(std::move(input)));
570 if (!alsa_) 570 if (!alsa_)
571 alsa_.reset(new AlsaWrapper()); 571 alsa_.reset(new AlsaWrapper());
572 572
573 DCHECK(input); 573 DCHECK(input);
574 // If the new input is a primary one, we may need to change the output 574 // If the new input is a primary one, we may need to change the output
575 // sample rate to match its input sample rate. 575 // sample rate to match its input sample rate.
576 // We only change the output rate if it is not set to a fixed value. 576 // We only change the output rate if it is not set to a fixed value.
577 if (input->primary() && 577 if (input->primary() &&
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 DCHECK(std::find(loopback_observers_.begin(), loopback_observers_.end(), 822 DCHECK(std::find(loopback_observers_.begin(), loopback_observers_.end(),
823 observer) != loopback_observers_.end()); 823 observer) != loopback_observers_.end());
824 loopback_observers_.erase(std::remove(loopback_observers_.begin(), 824 loopback_observers_.erase(std::remove(loopback_observers_.begin(),
825 loopback_observers_.end(), observer), 825 loopback_observers_.end(), observer),
826 loopback_observers_.end()); 826 loopback_observers_.end());
827 observer->OnRemoved(); 827 observer->OnRemoved();
828 } 828 }
829 829
830 } // namespace media 830 } // namespace media
831 } // namespace chromecast 831 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/media/cma/backend/alsa/stream_mixer_alsa.h ('k') | chromecast/media/cma/backend/alsa/stream_mixer_alsa_input.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698