| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 ReleaseFFmpegResources(); | 337 ReleaseFFmpegResources(); |
| 338 | 338 |
| 339 // Initialize AVCodecContext structure. | 339 // Initialize AVCodecContext structure. |
| 340 codec_context_.reset(avcodec_alloc_context3(NULL)); | 340 codec_context_.reset(avcodec_alloc_context3(NULL)); |
| 341 VideoDecoderConfigToAVCodecContext(config_, codec_context_.get()); | 341 VideoDecoderConfigToAVCodecContext(config_, codec_context_.get()); |
| 342 | 342 |
| 343 // Enable motion vector search (potentially slow), strong deblocking filter | 343 // Enable motion vector search (potentially slow), strong deblocking filter |
| 344 // for damaged macroblocks, and set our error detection sensitivity. | 344 // for damaged macroblocks, and set our error detection sensitivity. |
| 345 codec_context_->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK; | 345 codec_context_->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK; |
| 346 codec_context_->thread_count = GetThreadCount(codec_context_->codec_id); | 346 codec_context_->thread_count = GetThreadCount(codec_context_->codec_id); |
| 347 codec_context_->thread_type = |
| 348 config_.live_mode() ? FF_THREAD_SLICE : FF_THREAD_FRAME; |
| 347 codec_context_->opaque = this; | 349 codec_context_->opaque = this; |
| 348 codec_context_->flags |= CODEC_FLAG_EMU_EDGE; | 350 codec_context_->flags |= CODEC_FLAG_EMU_EDGE; |
| 349 codec_context_->get_buffer = GetVideoBufferImpl; | 351 codec_context_->get_buffer = GetVideoBufferImpl; |
| 350 codec_context_->release_buffer = ReleaseVideoBufferImpl; | 352 codec_context_->release_buffer = ReleaseVideoBufferImpl; |
| 351 | 353 |
| 352 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); | 354 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); |
| 353 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 355 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
| 354 ReleaseFFmpegResources(); | 356 ReleaseFFmpegResources(); |
| 355 return false; | 357 return false; |
| 356 } | 358 } |
| 357 | 359 |
| 358 av_frame_.reset(av_frame_alloc()); | 360 av_frame_.reset(av_frame_alloc()); |
| 359 return true; | 361 return true; |
| 360 } | 362 } |
| 361 | 363 |
| 362 } // namespace media | 364 } // namespace media |
| OLD | NEW |