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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 if (format == VideoFrame::INVALID) | 74 if (format == VideoFrame::INVALID) |
75 return AVERROR(EINVAL); | 75 return AVERROR(EINVAL); |
76 DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16); | 76 DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16); |
77 | 77 |
78 int width = codec_context->width; | 78 int width = codec_context->width; |
79 int height = codec_context->height; | 79 int height = codec_context->height; |
80 int ret; | 80 int ret; |
81 if ((ret = av_image_check_size(width, height, 0, NULL)) < 0) | 81 if ((ret = av_image_check_size(width, height, 0, NULL)) < 0) |
82 return ret; | 82 return ret; |
83 | 83 |
84 if (!VideoFrame::IsValidConfig(format, width, height)) | |
85 return AVERROR(EINVAL); | |
86 | |
84 scoped_refptr<VideoFrame> video_frame = | 87 scoped_refptr<VideoFrame> video_frame = |
85 VideoFrame::CreateFrame(format, width, height, kNoTimestamp()); | 88 VideoFrame::CreateFrame(format, width, height, kNoTimestamp()); |
scherkus (not reviewing)
2012/08/06 20:42:34
this DCHECKs for IsValidConfig() but in release mo
| |
86 | 89 |
87 for (int i = 0; i < 3; i++) { | 90 for (int i = 0; i < 3; i++) { |
88 frame->base[i] = video_frame->data(i); | 91 frame->base[i] = video_frame->data(i); |
89 frame->data[i] = video_frame->data(i); | 92 frame->data[i] = video_frame->data(i); |
90 frame->linesize[i] = video_frame->stride(i); | 93 frame->linesize[i] = video_frame->stride(i); |
91 } | 94 } |
92 | 95 |
93 frame->opaque = video_frame.release(); | 96 frame->opaque = video_frame.release(); |
94 frame->type = FF_BUFFER_TYPE_USER; | 97 frame->type = FF_BUFFER_TYPE_USER; |
95 frame->pkt_pts = codec_context->pkt ? codec_context->pkt->pts : | 98 frame->pkt_pts = codec_context->pkt ? codec_context->pkt->pts : |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
513 av_free(codec_context_); | 516 av_free(codec_context_); |
514 codec_context_ = NULL; | 517 codec_context_ = NULL; |
515 } | 518 } |
516 if (av_frame_) { | 519 if (av_frame_) { |
517 av_free(av_frame_); | 520 av_free(av_frame_); |
518 av_frame_ = NULL; | 521 av_frame_ = NULL; |
519 } | 522 } |
520 } | 523 } |
521 | 524 |
522 } // namespace media | 525 } // namespace media |
OLD | NEW |