Chromium Code Reviews| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 ReleaseFFmpegResources(); | 350 ReleaseFFmpegResources(); |
| 351 | 351 |
| 352 // Initialize AVCodecContext structure. | 352 // Initialize AVCodecContext structure. |
| 353 codec_context_.reset(avcodec_alloc_context3(NULL)); | 353 codec_context_.reset(avcodec_alloc_context3(NULL)); |
| 354 VideoDecoderConfigToAVCodecContext(config_, codec_context_.get()); | 354 VideoDecoderConfigToAVCodecContext(config_, codec_context_.get()); |
| 355 | 355 |
| 356 codec_context_->thread_count = GetThreadCount(codec_context_->codec_id); | 356 codec_context_->thread_count = GetThreadCount(codec_context_->codec_id); |
| 357 codec_context_->thread_type = low_delay ? FF_THREAD_SLICE : FF_THREAD_FRAME; | 357 codec_context_->thread_type = low_delay ? FF_THREAD_SLICE : FF_THREAD_FRAME; |
| 358 codec_context_->opaque = this; | 358 codec_context_->opaque = this; |
| 359 codec_context_->flags |= CODEC_FLAG_EMU_EDGE; | 359 codec_context_->flags |= CODEC_FLAG_EMU_EDGE; |
| 360 codec_context_->flags2 |= CODEC_FLAG2_CHUNKS; | |
|
DaleCurtis
2014/05/30 17:49:06
This will disable frame threading for all clients
| |
| 360 codec_context_->get_buffer2 = GetVideoBufferImpl; | 361 codec_context_->get_buffer2 = GetVideoBufferImpl; |
| 361 codec_context_->refcounted_frames = 1; | 362 codec_context_->refcounted_frames = 1; |
| 362 | 363 |
| 363 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); | 364 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); |
| 364 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 365 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
| 365 ReleaseFFmpegResources(); | 366 ReleaseFFmpegResources(); |
| 366 return false; | 367 return false; |
| 367 } | 368 } |
| 368 | 369 |
| 369 av_frame_.reset(av_frame_alloc()); | 370 av_frame_.reset(av_frame_alloc()); |
| 370 return true; | 371 return true; |
| 371 } | 372 } |
| 372 | 373 |
| 373 } // namespace media | 374 } // namespace media |
| OLD | NEW |