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

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

Issue 1904213003: Convert //media/filters from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 bool FFmpegGlue::OpenContext() { 156 bool FFmpegGlue::OpenContext() {
157 DCHECK(!open_called_) << "OpenContext() shouldn't be called twice."; 157 DCHECK(!open_called_) << "OpenContext() shouldn't be called twice.";
158 158
159 // If avformat_open_input() is called we have to take a slightly different 159 // If avformat_open_input() is called we have to take a slightly different
160 // destruction path to avoid double frees. 160 // destruction path to avoid double frees.
161 open_called_ = true; 161 open_called_ = true;
162 162
163 // Attempt to recognize the container by looking at the first few bytes of the 163 // Attempt to recognize the container by looking at the first few bytes of the
164 // stream. The stream position is left unchanged. 164 // stream. The stream position is left unchanged.
165 scoped_ptr<std::vector<uint8_t>> buffer(new std::vector<uint8_t>(8192)); 165 std::unique_ptr<std::vector<uint8_t>> buffer(new std::vector<uint8_t>(8192));
166 166
167 int64_t pos = AVIOSeekOperation(avio_context_.get()->opaque, 0, SEEK_CUR); 167 int64_t pos = AVIOSeekOperation(avio_context_.get()->opaque, 0, SEEK_CUR);
168 AVIOSeekOperation(avio_context_.get()->opaque, 0, SEEK_SET); 168 AVIOSeekOperation(avio_context_.get()->opaque, 0, SEEK_SET);
169 int numRead = AVIOReadOperation( 169 int numRead = AVIOReadOperation(
170 avio_context_.get()->opaque, buffer.get()->data(), buffer.get()->size()); 170 avio_context_.get()->opaque, buffer.get()->data(), buffer.get()->size());
171 AVIOSeekOperation(avio_context_.get()->opaque, pos, SEEK_SET); 171 AVIOSeekOperation(avio_context_.get()->opaque, pos, SEEK_SET);
172 if (numRead > 0) { 172 if (numRead > 0) {
173 // < 0 means Read failed 173 // < 0 means Read failed
174 container_names::MediaContainerName container = 174 container_names::MediaContainerName container =
175 container_names::DetermineContainer(buffer.get()->data(), numRead); 175 container_names::DetermineContainer(buffer.get()->data(), numRead);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 avcodec_close(stream->codec); 216 avcodec_close(stream->codec);
217 } 217 }
218 } 218 }
219 } 219 }
220 220
221 avformat_close_input(&format_context_); 221 avformat_close_input(&format_context_);
222 av_free(avio_context_->buffer); 222 av_free(avio_context_->buffer);
223 } 223 }
224 224
225 } // namespace media 225 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698