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

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: 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 | no next file » | 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 available_va_surface_ids_.push_back(va_surface_id); 279 available_va_surface_ids_.push_back(va_surface_id);
280 EncodeFrameTask(); 280 EncodeFrameTask();
281 } 281 }
282 282
283 void VaapiVideoEncodeAccelerator::BeginFrame(bool force_keyframe) { 283 void VaapiVideoEncodeAccelerator::BeginFrame(bool force_keyframe) {
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
292 current_pic_.type = media::H264SliceHeader::kPSlice;
293
294 if (current_pic_.frame_num % idr_period_ == 0) {
Pawel Osciak 2014/10/30 00:09:46 This is generating IDR on each i_period, which is
hshi1 2014/10/30 00:18:01 Done.
295 current_pic_.idr = true; 291 current_pic_.idr = true;
296 last_idr_frame_num_ = current_pic_.frame_num; 292 last_idr_frame_num_ = current_pic_.frame_num;
297 ref_pic_list0_.clear(); 293 ref_pic_list0_.clear();
294 } else {
295 current_pic_.type = media::H264SliceHeader::kPSlice;
298 } 296 }
299 297
300 if (current_pic_.type != media::H264SliceHeader::kBSlice) 298 if (current_pic_.type != media::H264SliceHeader::kBSlice)
301 current_pic_.ref = true; 299 current_pic_.ref = true;
302 300
303 current_pic_.pic_order_cnt = current_pic_.frame_num * 2; 301 current_pic_.pic_order_cnt = current_pic_.frame_num * 2;
304 current_pic_.top_field_order_cnt = current_pic_.pic_order_cnt; 302 current_pic_.top_field_order_cnt = current_pic_.pic_order_cnt;
305 current_pic_.pic_order_cnt_lsb = current_pic_.pic_order_cnt; 303 current_pic_.pic_order_cnt_lsb = current_pic_.pic_order_cnt;
306 304
307 current_encode_job_->keyframe = 305 current_encode_job_->keyframe =
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 } 1057 }
1060 1058
1061 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() 1059 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob()
1062 : coded_buffer(VA_INVALID_ID), keyframe(false) { 1060 : coded_buffer(VA_INVALID_ID), keyframe(false) {
1063 } 1061 }
1064 1062
1065 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { 1063 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() {
1066 } 1064 }
1067 1065
1068 } // namespace content 1066 } // namespace content
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