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 // This is a workaround to zero being temporarily, as part of the initial |
| 749 // setup, provided by the webrtc video encode and a zero bitrate and |
| 750 // framerate not being accepted by VAAPI |
| 751 // TODO: This code is common with v4l2_video_encode_accelerator.cc, perhaps |
| 752 // it could be pulled up to RTCVideoEncoder |
| 753 if (bitrate < 1) |
| 754 bitrate = 1; |
| 755 if (framerate < 1) |
| 756 framerate = 1; |
| 757 |
748 UpdateRates(bitrate, framerate); | 758 UpdateRates(bitrate, framerate); |
749 | 759 |
750 UpdateSPS(); | 760 UpdateSPS(); |
751 GeneratePackedSPS(); | 761 GeneratePackedSPS(); |
752 | 762 |
753 // Submit new parameters along with next frame that will be processed. | 763 // Submit new parameters along with next frame that will be processed. |
754 encoding_parameters_changed_ = true; | 764 encoding_parameters_changed_ = true; |
755 } | 765 } |
756 | 766 |
757 void VaapiVideoEncodeAccelerator::Destroy() { | 767 void VaapiVideoEncodeAccelerator::Destroy() { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 } | 1062 } |
1053 | 1063 |
1054 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1064 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
1055 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1065 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
1056 } | 1066 } |
1057 | 1067 |
1058 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1068 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
1059 } | 1069 } |
1060 | 1070 |
1061 } // namespace content | 1071 } // namespace content |
OLD | NEW |