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

Side by Side Diff: media/filters/ffmpeg_glue.cc

Issue 2770293002: Detect HLS from demuxing results (Closed)
Patch Set: Minor changes in comments Created 3 years, 4 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/filters/ffmpeg_glue.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_glue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698