| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 FFmpegGlue::InitializeFFmpeg(); | 187 FFmpegGlue::InitializeFFmpeg(); |
| 188 config_ = config; | 188 config_ = config; |
| 189 | 189 |
| 190 // TODO(xhwang): Only set |config_| after we successfully configure the | 190 // TODO(xhwang): Only set |config_| after we successfully configure the |
| 191 // decoder. | 191 // decoder. |
| 192 if (!ConfigureDecoder(low_delay)) { | 192 if (!ConfigureDecoder(low_delay)) { |
| 193 bound_init_cb.Run(false); | 193 bound_init_cb.Run(false); |
| 194 return; | 194 return; |
| 195 } | 195 } |
| 196 | 196 |
| 197 output_cb_ = BindToCurrentLoop(output_cb); | 197 output_cb_ = output_cb; |
| 198 | 198 |
| 199 // Success! | 199 // Success! |
| 200 state_ = kNormal; | 200 state_ = kNormal; |
| 201 bound_init_cb.Run(true); | 201 bound_init_cb.Run(true); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void FFmpegVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, | 204 void FFmpegVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 205 const DecodeCB& decode_cb) { | 205 const DecodeCB& decode_cb) { |
| 206 DCHECK(thread_checker_.CalledOnValidThread()); | 206 DCHECK(thread_checker_.CalledOnValidThread()); |
| 207 DCHECK(buffer.get()); | 207 DCHECK(buffer.get()); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 374 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
| 375 ReleaseFFmpegResources(); | 375 ReleaseFFmpegResources(); |
| 376 return false; | 376 return false; |
| 377 } | 377 } |
| 378 | 378 |
| 379 av_frame_.reset(av_frame_alloc()); | 379 av_frame_.reset(av_frame_alloc()); |
| 380 return true; | 380 return true; |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace media | 383 } // namespace media |
| OLD | NEW |