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_video_decoder.h" | 5 #include "media/filters/ffmpeg_video_decoder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 output_cb_ = BindToCurrentLoop(output_cb); | 170 output_cb_ = BindToCurrentLoop(output_cb); |
171 | 171 |
172 // Success! | 172 // Success! |
173 state_ = kNormal; | 173 state_ = kNormal; |
174 initialize_cb.Run(PIPELINE_OK); | 174 initialize_cb.Run(PIPELINE_OK); |
175 } | 175 } |
176 | 176 |
177 void FFmpegVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, | 177 void FFmpegVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, |
178 const DecodeCB& decode_cb) { | 178 const DecodeCB& decode_cb) { |
179 DCHECK(task_runner_->BelongsToCurrentThread()); | 179 DCHECK(task_runner_->BelongsToCurrentThread()); |
180 DCHECK(buffer); | 180 DCHECK(buffer.get()); |
181 DCHECK(!decode_cb.is_null()); | 181 DCHECK(!decode_cb.is_null()); |
182 CHECK_NE(state_, kUninitialized); | 182 CHECK_NE(state_, kUninitialized); |
183 | 183 |
184 DecodeCB decode_cb_bound = BindToCurrentLoop(decode_cb); | 184 DecodeCB decode_cb_bound = BindToCurrentLoop(decode_cb); |
185 | 185 |
186 if (state_ == kError) { | 186 if (state_ == kError) { |
187 decode_cb_bound.Run(kDecodeError); | 187 decode_cb_bound.Run(kDecodeError); |
188 return; | 188 return; |
189 } | 189 } |
190 | 190 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 341 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
342 ReleaseFFmpegResources(); | 342 ReleaseFFmpegResources(); |
343 return false; | 343 return false; |
344 } | 344 } |
345 | 345 |
346 av_frame_.reset(av_frame_alloc()); | 346 av_frame_.reset(av_frame_alloc()); |
347 return true; | 347 return true; |
348 } | 348 } |
349 | 349 |
350 } // namespace media | 350 } // namespace media |
OLD | NEW |