| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 codec_context->sample_aspect_ratio.num, | 85 codec_context->sample_aspect_ratio.num, |
| 86 codec_context->sample_aspect_ratio.den); | 86 codec_context->sample_aspect_ratio.den); |
| 87 } else { | 87 } else { |
| 88 natural_size = config_.natural_size(); | 88 natural_size = config_.natural_size(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 if (!VideoFrame::IsValidConfig(format, size, gfx::Rect(size), natural_size)) | 91 if (!VideoFrame::IsValidConfig(format, size, gfx::Rect(size), natural_size)) |
| 92 return AVERROR(EINVAL); | 92 return AVERROR(EINVAL); |
| 93 | 93 |
| 94 scoped_refptr<VideoFrame> video_frame = | 94 scoped_refptr<VideoFrame> video_frame = |
| 95 VideoFrame::CreateFrame(format, size, gfx::Rect(size), natural_size, | 95 frame_pool_.CreateFrame(format, size, gfx::Rect(size), |
| 96 kNoTimestamp()); | 96 natural_size, kNoTimestamp()); |
| 97 | 97 |
| 98 for (int i = 0; i < 3; i++) { | 98 for (int i = 0; i < 3; i++) { |
| 99 frame->base[i] = video_frame->data(i); | 99 frame->base[i] = video_frame->data(i); |
| 100 frame->data[i] = video_frame->data(i); | 100 frame->data[i] = video_frame->data(i); |
| 101 frame->linesize[i] = video_frame->stride(i); | 101 frame->linesize[i] = video_frame->stride(i); |
| 102 } | 102 } |
| 103 | 103 |
| 104 frame->opaque = NULL; | 104 frame->opaque = NULL; |
| 105 video_frame.swap(reinterpret_cast<VideoFrame**>(&frame->opaque)); | 105 video_frame.swap(reinterpret_cast<VideoFrame**>(&frame->opaque)); |
| 106 frame->type = FF_BUFFER_TYPE_USER; | 106 frame->type = FF_BUFFER_TYPE_USER; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 380 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
| 381 ReleaseFFmpegResources(); | 381 ReleaseFFmpegResources(); |
| 382 return false; | 382 return false; |
| 383 } | 383 } |
| 384 | 384 |
| 385 av_frame_.reset(avcodec_alloc_frame()); | 385 av_frame_.reset(avcodec_alloc_frame()); |
| 386 return true; | 386 return true; |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace media | 389 } // namespace media |
| OLD | NEW |