| 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 |
| 99 // Register our protocol glue code with FFmpeg. | 102 // Register our protocol glue code with FFmpeg. |
| 100 if (av_lockmgr_register(&LockManagerOperation) != 0) | 103 if (av_lockmgr_register(&LockManagerOperation) != 0) |
| 101 return; | 104 return; |
| 102 | 105 |
| 103 // Now register the rest of FFmpeg. | 106 // Now register the rest of FFmpeg. |
| 104 av_register_all(); | 107 av_register_all(); |
| 105 | 108 |
| 106 initialized_ = true; | 109 initialized_ = true; |
| 107 } | 110 } |
| 108 | 111 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 avcodec_close(stream->codec); | 214 avcodec_close(stream->codec); |
| 212 } | 215 } |
| 213 } | 216 } |
| 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 |