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

Side by Side Diff: content/common/gpu/media/vaapi_video_encode_accelerator.cc

Issue 686283002: Vaapi VEA: always generate IDR when keyframe is requested. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test failure - forgot to set current_encode_job_->keyframe. Created 6 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
« no previous file with comments | « no previous file | content/common/gpu/media/video_encode_accelerator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/common/gpu/media/vaapi_video_encode_accelerator.h" 5 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 memset(&current_pic_, 0, sizeof(current_pic_)); 284 memset(&current_pic_, 0, sizeof(current_pic_));
285 285
286 current_pic_.frame_num = frame_num_++; 286 current_pic_.frame_num = frame_num_++;
287 frame_num_ %= idr_period_; 287 frame_num_ %= idr_period_;
288 288
289 if (current_pic_.frame_num % i_period_ == 0 || force_keyframe) 289 if (current_pic_.frame_num % i_period_ == 0 || force_keyframe)
290 current_pic_.type = media::H264SliceHeader::kISlice; 290 current_pic_.type = media::H264SliceHeader::kISlice;
291 else 291 else
292 current_pic_.type = media::H264SliceHeader::kPSlice; 292 current_pic_.type = media::H264SliceHeader::kPSlice;
293 293
294 if (current_pic_.frame_num % idr_period_ == 0) { 294 if (current_pic_.frame_num % idr_period_ == 0 || force_keyframe) {
295 current_pic_.idr = true; 295 current_pic_.idr = true;
296 last_idr_frame_num_ = current_pic_.frame_num; 296 last_idr_frame_num_ = current_pic_.frame_num;
297 ref_pic_list0_.clear(); 297 ref_pic_list0_.clear();
298 } 298 }
299 299
300 if (current_pic_.type != media::H264SliceHeader::kBSlice) 300 if (current_pic_.type != media::H264SliceHeader::kBSlice)
301 current_pic_.ref = true; 301 current_pic_.ref = true;
302 302
303 current_pic_.pic_order_cnt = current_pic_.frame_num * 2; 303 current_pic_.pic_order_cnt = current_pic_.frame_num * 2;
304 current_pic_.top_field_order_cnt = current_pic_.pic_order_cnt; 304 current_pic_.top_field_order_cnt = current_pic_.pic_order_cnt;
305 current_pic_.pic_order_cnt_lsb = current_pic_.pic_order_cnt; 305 current_pic_.pic_order_cnt_lsb = current_pic_.pic_order_cnt;
306 306
307 current_encode_job_->keyframe = 307 current_encode_job_->keyframe = current_pic_.idr;
308 (current_pic_.type == media::H264SliceHeader::kISlice);
309 308
310 DVLOGF(4) << "Starting a new frame, type: " << current_pic_.type 309 DVLOGF(4) << "Starting a new frame, type: " << current_pic_.type
311 << (force_keyframe ? " (forced keyframe)" : "") 310 << (force_keyframe ? " (forced keyframe)" : "")
312 << " frame_num: " << current_pic_.frame_num 311 << " frame_num: " << current_pic_.frame_num
313 << " POC: " << current_pic_.pic_order_cnt; 312 << " POC: " << current_pic_.pic_order_cnt;
314 } 313 }
315 314
316 void VaapiVideoEncodeAccelerator::EndFrame() { 315 void VaapiVideoEncodeAccelerator::EndFrame() {
317 // Store the picture on the list of reference pictures and keep the list 316 // Store the picture on the list of reference pictures and keep the list
318 // below maximum size, dropping oldest references. 317 // below maximum size, dropping oldest references.
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 } 1058 }
1060 1059
1061 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() 1060 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob()
1062 : coded_buffer(VA_INVALID_ID), keyframe(false) { 1061 : coded_buffer(VA_INVALID_ID), keyframe(false) {
1063 } 1062 }
1064 1063
1065 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { 1064 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() {
1066 } 1065 }
1067 1066
1068 } // namespace content 1067 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/media/video_encode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698