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

Side by Side Diff: media/base/media_tracks.cc

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: . 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/base/media_tracks.h" 5 #include "media/base/media_tracks.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h"
8 #include "media/base/audio_decoder_config.h" 9 #include "media/base/audio_decoder_config.h"
9 #include "media/base/video_decoder_config.h" 10 #include "media/base/video_decoder_config.h"
10 11
11 namespace media { 12 namespace media {
12 13
13 MediaTracks::MediaTracks() {} 14 MediaTracks::MediaTracks() {}
14 15
15 MediaTracks::~MediaTracks() {} 16 MediaTracks::~MediaTracks() {}
16 17
17 void MediaTracks::AddAudioTrack(const AudioDecoderConfig& config, 18 void MediaTracks::AddAudioTrack(const AudioDecoderConfig& config,
18 const std::string& id, 19 const std::string& id,
19 const std::string& kind, 20 const std::string& kind,
20 const std::string& label, 21 const std::string& label,
21 const std::string& language) { 22 const std::string& language) {
22 DCHECK(config.IsValidConfig()); 23 DCHECK(config.IsValidConfig());
23 CHECK(audio_configs_.find(id) == audio_configs_.end()); 24 CHECK(audio_configs_.find(id) == audio_configs_.end());
24 scoped_ptr<MediaTrack> track = make_scoped_ptr( 25 std::unique_ptr<MediaTrack> track = base::WrapUnique(
25 new MediaTrack(MediaTrack::Audio, id, kind, label, language)); 26 new MediaTrack(MediaTrack::Audio, id, kind, label, language));
26 tracks_.push_back(std::move(track)); 27 tracks_.push_back(std::move(track));
27 audio_configs_[id] = config; 28 audio_configs_[id] = config;
28 } 29 }
29 30
30 void MediaTracks::AddVideoTrack(const VideoDecoderConfig& config, 31 void MediaTracks::AddVideoTrack(const VideoDecoderConfig& config,
31 const std::string& id, 32 const std::string& id,
32 const std::string& kind, 33 const std::string& kind,
33 const std::string& label, 34 const std::string& label,
34 const std::string& language) { 35 const std::string& language) {
35 DCHECK(config.IsValidConfig()); 36 DCHECK(config.IsValidConfig());
36 CHECK(video_configs_.find(id) == video_configs_.end()); 37 CHECK(video_configs_.find(id) == video_configs_.end());
37 scoped_ptr<MediaTrack> track = make_scoped_ptr( 38 std::unique_ptr<MediaTrack> track = base::WrapUnique(
38 new MediaTrack(MediaTrack::Video, id, kind, label, language)); 39 new MediaTrack(MediaTrack::Video, id, kind, label, language));
39 tracks_.push_back(std::move(track)); 40 tracks_.push_back(std::move(track));
40 video_configs_[id] = config; 41 video_configs_[id] = config;
41 } 42 }
42 43
43 const AudioDecoderConfig& MediaTracks::getAudioConfig( 44 const AudioDecoderConfig& MediaTracks::getAudioConfig(
44 const std::string& id) const { 45 const std::string& id) const {
45 auto it = audio_configs_.find(id); 46 auto it = audio_configs_.find(id);
46 if (it != audio_configs_.end()) 47 if (it != audio_configs_.end())
47 return it->second; 48 return it->second;
(...skipping 24 matching lines...) Expand all
72 for (const auto& track : tracks()) { 73 for (const auto& track : tracks()) {
73 if (track->type() == MediaTrack::Video) { 74 if (track->type() == MediaTrack::Video) {
74 return getVideoConfig(track->id()); 75 return getVideoConfig(track->id());
75 } 76 }
76 } 77 }
77 static VideoDecoderConfig invalidConfig; 78 static VideoDecoderConfig invalidConfig;
78 return invalidConfig; 79 return invalidConfig;
79 } 80 }
80 81
81 } // namespace media 82 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698