Chromium Code Reviews| Index: media/gpu/vt_video_decode_accelerator_mac.cc |
| diff --git a/media/gpu/vt_video_decode_accelerator_mac.cc b/media/gpu/vt_video_decode_accelerator_mac.cc |
| index 59cb2ce28734e0afc6621ac8e7ce5c96fd4a4f45..53a312a04b12e9963dfb62d84b069a23591e1e62 100644 |
| --- a/media/gpu/vt_video_decode_accelerator_mac.cc |
| +++ b/media/gpu/vt_video_decode_accelerator_mac.cc |
| @@ -209,6 +209,13 @@ bool InitializeVideoToolboxInternal() { |
| // TODO(sandersd): Share this computation with the VAAPI decoder. |
| int32_t ComputeReorderWindow(const H264SPS* sps) { |
| + // When |pic_order_cnt_type| == 2, decode order always matches presentation |
| + // order. |
| + // TODO(sandersd): For |pic_order_cnt_type| == 1, analyze the delta cycle to |
| + // find the minimum required reorder window. |
| + if (sps->pic_order_cnt_type == 2) |
| + return 0; |
| + |
| // TODO(sandersd): Compute MaxDpbFrames. |
| int32_t max_dpb_frames = 16; |
| @@ -592,6 +599,7 @@ void VTVideoDecodeAccelerator::DecodeTask(const BitstreamBuffer& bitstream, |
| frame->has_slice = true; |
| frame->is_idr = nalu.nal_unit_type == media::H264NALU::kIDRSlice; |
| + frame->has_mmco5 = poc_.IsPendingMMCO5(); |
| frame->pic_order_cnt = pic_order_cnt; |
| frame->reorder_window = ComputeReorderWindow(sps); |
| } |
| @@ -604,9 +612,8 @@ void VTVideoDecodeAccelerator::DecodeTask(const BitstreamBuffer& bitstream, |
| } |
| } |
| - if (frame->is_idr) { |
| + if (frame->is_idr) |
| waiting_for_idr_ = false; |
| - } |
| // If no IDR has been seen yet, skip decoding. Note that Flash sends |
| // configuration changes as a bitstream with only SPS/PPS; we don't print |
| @@ -943,7 +950,8 @@ bool VTVideoDecodeAccelerator::ProcessTaskQueue() { |
| switch (task.type) { |
| case TASK_FRAME: |
| if (reorder_queue_.size() < kMaxReorderQueueSize && |
| - (!task.frame->is_idr || reorder_queue_.empty())) { |
| + (!task.frame->is_idr || !task.frame->has_mmco5 || |
|
Pawel Osciak
2017/02/17 04:53:26
Should this be (!task.frame->is_idr && !task.frame
sandersd (OOO until July 31)
2017/02/18 00:46:34
I expanded the code, hopefully it is clear now.
|
| + reorder_queue_.empty())) { |
| DVLOG(2) << "Decode(" << task.frame->bitstream_id << ") complete"; |
| assigned_bitstream_ids_.erase(task.frame->bitstream_id); |
| client_->NotifyEndOfBitstreamBuffer(task.frame->bitstream_id); |
| @@ -994,8 +1002,9 @@ bool VTVideoDecodeAccelerator::ProcessReorderQueue() { |
| // the next frame is an IDR), then we don't need a full reorder buffer to send |
| // the next frame. |
| bool flushing = |
| - !task_queue_.empty() && (task_queue_.front().type != TASK_FRAME || |
| - task_queue_.front().frame->is_idr); |
| + !task_queue_.empty() && |
| + (task_queue_.front().type != TASK_FRAME || |
| + task_queue_.front().frame->is_idr || task_queue_.front().has_mmco5); |
| size_t reorder_window = std::max(0, reorder_queue_.top()->reorder_window); |
| DVLOG(3) << __func__ << " size=" << reorder_queue_.size() |