Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Side by Side Diff: media/filters/ffmpeg_video_decoder.cc

Issue 399107: Merge 32455 - Check for null frame pointers and do nothing to avoid a crash.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/195/src/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:mergeinfo
Reverse-merged /trunk/src/media/filters/ffmpeg_video_decoder.cc:r21611,23937,25416
Reverse-merged /branches/chrome_webkit_merge_branch/media/filters/ffmpeg_video_decoder.cc:r69-2775
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "media/base/limits.h" 5 #include "media/base/limits.h"
6 #include "media/base/video_frame_impl.h" 6 #include "media/base/video_frame_impl.h"
7 #include "media/filters/ffmpeg_common.h" 7 #include "media/filters/ffmpeg_common.h"
8 #include "media/filters/ffmpeg_demuxer.h" 8 #include "media/filters/ffmpeg_demuxer.h"
9 #include "media/filters/ffmpeg_video_decoder.h" 9 #include "media/filters/ffmpeg_video_decoder.h"
10 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (state_ == kFlushCodec) { 188 if (state_ == kFlushCodec) {
189 state_ = kDecodeFinished; 189 state_ = kDecodeFinished;
190 EnqueueEmptyFrame(); 190 EnqueueEmptyFrame();
191 } 191 }
192 } 192 }
193 } 193 }
194 194
195 bool FFmpegVideoDecoder::EnqueueVideoFrame(VideoSurface::Format surface_format, 195 bool FFmpegVideoDecoder::EnqueueVideoFrame(VideoSurface::Format surface_format,
196 const TimeTuple& time, 196 const TimeTuple& time,
197 const AVFrame* frame) { 197 const AVFrame* frame) {
198 // TODO(fbarchard): Work around for FFmpeg http://crbug.com/27675
199 // The decoder is in a bad state and not decoding correctly.
200 // Checking for NULL avoids a crash in CopyPlane().
201 if (!frame->data[VideoSurface::kYPlane] ||
202 !frame->data[VideoSurface::kUPlane] ||
203 !frame->data[VideoSurface::kVPlane]) {
204 return true;
205 }
206
198 scoped_refptr<VideoFrame> video_frame; 207 scoped_refptr<VideoFrame> video_frame;
199 VideoFrameImpl::CreateFrame(surface_format, width_, height_, 208 VideoFrameImpl::CreateFrame(surface_format, width_, height_,
200 time.timestamp, time.duration, &video_frame); 209 time.timestamp, time.duration, &video_frame);
201 if (!video_frame) { 210 if (!video_frame) {
202 return false; 211 return false;
203 } 212 }
204 213
205 // Copy the frame data since FFmpeg reuses internal buffers for AVFrame 214 // Copy the frame data since FFmpeg reuses internal buffers for AVFrame
206 // output, meaning the data is only valid until the next 215 // output, meaning the data is only valid until the next
207 // avcodec_decode_video() call. 216 // avcodec_decode_video() call.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // static 361 // static
353 bool FFmpegVideoDecoder::PtsHeapOrdering::operator()( 362 bool FFmpegVideoDecoder::PtsHeapOrdering::operator()(
354 const base::TimeDelta& lhs, 363 const base::TimeDelta& lhs,
355 const base::TimeDelta& rhs) const { 364 const base::TimeDelta& rhs) const {
356 // std::priority_queue is a max-heap. We want lower timestamps to show up 365 // std::priority_queue is a max-heap. We want lower timestamps to show up
357 // first so reverse the natural less-than comparison. 366 // first so reverse the natural less-than comparison.
358 return rhs < lhs; 367 return rhs < lhs;
359 } 368 }
360 369
361 } // namespace 370 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698