Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 cpb_size_ = bitrate_ * kCPBWindowSizeMs / 1000; | 738 cpb_size_ = bitrate_ * kCPBWindowSizeMs / 1000; |
| 739 } | 739 } |
| 740 | 740 |
| 741 void VaapiVideoEncodeAccelerator::RequestEncodingParametersChangeTask( | 741 void VaapiVideoEncodeAccelerator::RequestEncodingParametersChangeTask( |
| 742 uint32 bitrate, | 742 uint32 bitrate, |
| 743 uint32 framerate) { | 743 uint32 framerate) { |
| 744 DVLOGF(2) << "bitrate: " << bitrate << " framerate: " << framerate; | 744 DVLOGF(2) << "bitrate: " << bitrate << " framerate: " << framerate; |
| 745 DCHECK(encoder_thread_proxy_->BelongsToCurrentThread()); | 745 DCHECK(encoder_thread_proxy_->BelongsToCurrentThread()); |
| 746 DCHECK_NE(state_, kUninitialized); | 746 DCHECK_NE(state_, kUninitialized); |
| 747 | 747 |
| 748 if (bitrate < 1) | |
| 749 bitrate = 1; | |
| 750 if (framerate < 1) | |
| 751 framerate = 1; | |
|
xhwang
2014/07/07 16:30:51
I am not really familiar with this code, so some n
| |
| 752 | |
| 748 UpdateRates(bitrate, framerate); | 753 UpdateRates(bitrate, framerate); |
| 749 | 754 |
| 750 UpdateSPS(); | 755 UpdateSPS(); |
| 751 GeneratePackedSPS(); | 756 GeneratePackedSPS(); |
| 752 | 757 |
| 753 // Submit new parameters along with next frame that will be processed. | 758 // Submit new parameters along with next frame that will be processed. |
| 754 encoding_parameters_changed_ = true; | 759 encoding_parameters_changed_ = true; |
| 755 } | 760 } |
| 756 | 761 |
| 757 void VaapiVideoEncodeAccelerator::Destroy() { | 762 void VaapiVideoEncodeAccelerator::Destroy() { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1052 } | 1057 } |
| 1053 | 1058 |
| 1054 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1059 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
| 1055 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1060 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
| 1056 } | 1061 } |
| 1057 | 1062 |
| 1058 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1063 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
| 1059 } | 1064 } |
| 1060 | 1065 |
| 1061 } // namespace content | 1066 } // namespace content |
| OLD | NEW |