OLD | NEW |
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 "base/memory/ptr_util.h" |
9 #include "media/base/audio_decoder_config.h" | 9 #include "media/base/audio_decoder_config.h" |
10 #include "media/base/video_decoder_config.h" | 10 #include "media/base/video_decoder_config.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 const VideoDecoderConfig& MediaTracks::getVideoConfig( | 59 const VideoDecoderConfig& MediaTracks::getVideoConfig( |
60 StreamParser::TrackId bytestream_track_id) const { | 60 StreamParser::TrackId bytestream_track_id) const { |
61 auto it = video_configs_.find(bytestream_track_id); | 61 auto it = video_configs_.find(bytestream_track_id); |
62 if (it != video_configs_.end()) | 62 if (it != video_configs_.end()) |
63 return it->second; | 63 return it->second; |
64 static VideoDecoderConfig invalidConfig; | 64 static VideoDecoderConfig invalidConfig; |
65 return invalidConfig; | 65 return invalidConfig; |
66 } | 66 } |
67 | 67 |
68 const AudioDecoderConfig& MediaTracks::getFirstAudioConfig() const { | |
69 for (const auto& track : tracks()) { | |
70 if (track->type() == MediaTrack::Audio) { | |
71 return getAudioConfig(track->bytestream_track_id()); | |
72 } | |
73 } | |
74 static AudioDecoderConfig invalidConfig; | |
75 return invalidConfig; | |
76 } | |
77 | |
78 const VideoDecoderConfig& MediaTracks::getFirstVideoConfig() const { | |
79 for (const auto& track : tracks()) { | |
80 if (track->type() == MediaTrack::Video) { | |
81 return getVideoConfig(track->bytestream_track_id()); | |
82 } | |
83 } | |
84 static VideoDecoderConfig invalidConfig; | |
85 return invalidConfig; | |
86 } | |
87 | |
88 } // namespace media | 68 } // namespace media |
OLD | NEW |