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/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // FFmpeg must only be initialized once, so use a LazyInstance to ensure this. | 89 // FFmpeg must only be initialized once, so use a LazyInstance to ensure this. |
90 class FFmpegInitializer { | 90 class FFmpegInitializer { |
91 public: | 91 public: |
92 bool initialized() { return initialized_; } | 92 bool initialized() { return initialized_; } |
93 | 93 |
94 private: | 94 private: |
95 friend struct base::DefaultLazyInstanceTraits<FFmpegInitializer>; | 95 friend struct base::DefaultLazyInstanceTraits<FFmpegInitializer>; |
96 | 96 |
97 FFmpegInitializer() | 97 FFmpegInitializer() |
98 : initialized_(false) { | 98 : initialized_(false) { |
99 // Before doing anything disable logging as it interferes with layout tests. | |
100 av_log_set_level(AV_LOG_QUIET); | |
101 | |
102 // Register our protocol glue code with FFmpeg. | 99 // Register our protocol glue code with FFmpeg. |
103 if (av_lockmgr_register(&LockManagerOperation) != 0) | 100 if (av_lockmgr_register(&LockManagerOperation) != 0) |
104 return; | 101 return; |
105 | 102 |
106 // Now register the rest of FFmpeg. | 103 // Now register the rest of FFmpeg. |
107 av_register_all(); | 104 av_register_all(); |
108 | 105 |
109 initialized_ = true; | 106 initialized_ = true; |
110 } | 107 } |
111 | 108 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 avcodec_close(stream->codec); | 211 avcodec_close(stream->codec); |
215 } | 212 } |
216 } | 213 } |
217 } | 214 } |
218 | 215 |
219 avformat_close_input(&format_context_); | 216 avformat_close_input(&format_context_); |
220 av_free(avio_context_->buffer); | 217 av_free(avio_context_->buffer); |
221 } | 218 } |
222 | 219 |
223 } // namespace media | 220 } // namespace media |
OLD | NEW |