OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/filters/ffmpeg_glue.h" | 5 #include "media/filters/ffmpeg_glue.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (pos < 0) | 158 if (pos < 0) |
159 return false; | 159 return false; |
160 | 160 |
161 const int num_read = | 161 const int num_read = |
162 AVIOReadOperation(avio_context_->opaque, buffer.data(), buffer.size()); | 162 AVIOReadOperation(avio_context_->opaque, buffer.data(), buffer.size()); |
163 if (num_read < container_names::kMinimumContainerSize) | 163 if (num_read < container_names::kMinimumContainerSize) |
164 return false; | 164 return false; |
165 | 165 |
166 container_ = container_names::DetermineContainer(buffer.data(), num_read); | 166 container_ = container_names::DetermineContainer(buffer.data(), num_read); |
167 UMA_HISTOGRAM_SPARSE_SLOWLY("Media.DetectedContainer", container_); | 167 UMA_HISTOGRAM_SPARSE_SLOWLY("Media.DetectedContainer", container_); |
| 168 |
| 169 detected_hls_ = |
| 170 container_ == container_names::MediaContainerName::CONTAINER_HLS; |
168 return false; | 171 return false; |
169 } else if (ret < 0) { | 172 } else if (ret < 0) { |
170 return false; | 173 return false; |
171 } | 174 } |
172 | 175 |
173 // Rely on ffmpeg's parsing if we're able to succesfully open the file. | 176 // Rely on ffmpeg's parsing if we're able to succesfully open the file. |
174 if (strcmp(format_context_->iformat->name, "mov,mp4,m4a,3gp,3g2,mj2") == 0) | 177 if (strcmp(format_context_->iformat->name, "mov,mp4,m4a,3gp,3g2,mj2") == 0) |
175 container_ = container_names::CONTAINER_MOV; | 178 container_ = container_names::CONTAINER_MOV; |
176 else if (strcmp(format_context_->iformat->name, "flac") == 0) | 179 else if (strcmp(format_context_->iformat->name, "flac") == 0) |
177 container_ = container_names::CONTAINER_FLAC; | 180 container_ = container_names::CONTAINER_FLAC; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 avformat_free_context(format_context_); | 214 avformat_free_context(format_context_); |
212 av_free(avio_context_->buffer); | 215 av_free(avio_context_->buffer); |
213 return; | 216 return; |
214 } | 217 } |
215 | 218 |
216 avformat_close_input(&format_context_); | 219 avformat_close_input(&format_context_); |
217 av_free(avio_context_->buffer); | 220 av_free(avio_context_->buffer); |
218 } | 221 } |
219 | 222 |
220 } // namespace media | 223 } // namespace media |
OLD | NEW |