Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/video/ffmpeg_video_decode_engine.h" | 5 #include "media/video/ffmpeg_video_decode_engine.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 ConvertFromTimeBase(doubled_time_base, 2 + av_frame_->repeat_pict); | 296 ConvertFromTimeBase(doubled_time_base, 2 + av_frame_->repeat_pict); |
| 297 | 297 |
| 298 if (!direct_rendering_) { | 298 if (!direct_rendering_) { |
| 299 // Available frame is guaranteed, because we issue as much reads as | 299 // Available frame is guaranteed, because we issue as much reads as |
| 300 // available frame, except the case of |frame_decoded| == 0, which | 300 // available frame, except the case of |frame_decoded| == 0, which |
| 301 // implies decoder order delay, and force us to read more inputs. | 301 // implies decoder order delay, and force us to read more inputs. |
| 302 DCHECK(frame_queue_available_.size()); | 302 DCHECK(frame_queue_available_.size()); |
| 303 video_frame = frame_queue_available_.front(); | 303 video_frame = frame_queue_available_.front(); |
| 304 frame_queue_available_.pop_front(); | 304 frame_queue_available_.pop_front(); |
| 305 | 305 |
| 306 if ((video_frame->width() != codec_context_->width) || | |
| 307 (video_frame->height() != codec_context_->height)) { | |
| 308 | |
|
Ami GONE FROM CHROMIUM
2011/05/19 20:27:37
extra newline
acolwell GONE FROM CHROMIUM
2011/05/20 01:26:37
Done.
| |
| 309 VideoFrame::CreateFrame(VideoFrame::YV12, | |
| 310 codec_context_->width, | |
| 311 codec_context_->height, | |
| 312 kNoTimestamp, | |
| 313 kNoTimestamp, | |
| 314 &video_frame); | |
| 315 } | |
| 316 | |
| 306 // Copy the frame data since FFmpeg reuses internal buffers for AVFrame | 317 // Copy the frame data since FFmpeg reuses internal buffers for AVFrame |
| 307 // output, meaning the data is only valid until the next | 318 // output, meaning the data is only valid until the next |
| 308 // avcodec_decode_video() call. | 319 // avcodec_decode_video() call. |
| 309 size_t height = codec_context_->height; | 320 size_t height = codec_context_->height; |
| 310 CopyPlane(VideoFrame::kYPlane, video_frame.get(), av_frame_.get(), height); | 321 CopyPlane(VideoFrame::kYPlane, video_frame.get(), av_frame_.get(), height); |
| 311 CopyPlane(VideoFrame::kUPlane, video_frame.get(), av_frame_.get(), height); | 322 CopyPlane(VideoFrame::kUPlane, video_frame.get(), av_frame_.get(), height); |
| 312 CopyPlane(VideoFrame::kVPlane, video_frame.get(), av_frame_.get(), height); | 323 CopyPlane(VideoFrame::kVPlane, video_frame.get(), av_frame_.get(), height); |
| 313 } else { | 324 } else { |
| 314 // Get the VideoFrame from allocator which associate with av_frame_. | 325 // Get the VideoFrame from allocator which associate with av_frame_. |
| 315 video_frame = allocator_->DecodeDone(codec_context_, av_frame_.get()); | 326 video_frame = allocator_->DecodeDone(codec_context_, av_frame_.get()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 break; | 393 break; |
| 383 } | 394 } |
| 384 return VideoFrame::INVALID; | 395 return VideoFrame::INVALID; |
| 385 } | 396 } |
| 386 | 397 |
| 387 } // namespace media | 398 } // namespace media |
| 388 | 399 |
| 389 // Disable refcounting for this object because this object only lives | 400 // Disable refcounting for this object because this object only lives |
| 390 // on the video decoder thread and there's no need to refcount it. | 401 // on the video decoder thread and there's no need to refcount it. |
| 391 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::FFmpegVideoDecodeEngine); | 402 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::FFmpegVideoDecodeEngine); |
| OLD | NEW |