OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/gpu/android_video_encode_accelerator.h" | 5 #include "media/gpu/android_video_encode_accelerator.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <tuple> | 9 #include <tuple> |
10 | 10 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 266 } |
267 | 267 |
268 void AndroidVideoEncodeAccelerator::RequestEncodingParametersChange( | 268 void AndroidVideoEncodeAccelerator::RequestEncodingParametersChange( |
269 uint32_t bitrate, | 269 uint32_t bitrate, |
270 uint32_t framerate) { | 270 uint32_t framerate) { |
271 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitrate: " << bitrate | 271 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitrate: " << bitrate |
272 << ", framerate: " << framerate; | 272 << ", framerate: " << framerate; |
273 DCHECK(thread_checker_.CalledOnValidThread()); | 273 DCHECK(thread_checker_.CalledOnValidThread()); |
274 if (bitrate != last_set_bitrate_) { | 274 if (bitrate != last_set_bitrate_) { |
275 last_set_bitrate_ = bitrate; | 275 last_set_bitrate_ = bitrate; |
276 media_codec_->SetVideoBitrate(bitrate); | 276 media_codec_->SetVideoBitrate(bitrate, framerate); |
277 } | 277 } |
278 // Note: Android's MediaCodec doesn't allow mid-stream adjustments to | 278 // Note: Android's MediaCodec doesn't allow mid-stream adjustments to |
279 // framerate, so we ignore that here. This is OK because Android only uses | 279 // framerate, so we ignore that here. This is OK because Android only uses |
280 // the framerate value from MediaFormat during configure() as a proxy for | 280 // the framerate value from MediaFormat during configure() as a proxy for |
281 // bitrate, and we set that explicitly. | 281 // bitrate, and we set that explicitly. |
282 } | 282 } |
283 | 283 |
284 void AndroidVideoEncodeAccelerator::Destroy() { | 284 void AndroidVideoEncodeAccelerator::Destroy() { |
285 DVLOG(3) << __PRETTY_FUNCTION__; | 285 DVLOG(3) << __PRETTY_FUNCTION__; |
286 DCHECK(thread_checker_.CalledOnValidThread()); | 286 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 --num_buffers_at_codec_; | 422 --num_buffers_at_codec_; |
423 | 423 |
424 base::ThreadTaskRunnerHandle::Get()->PostTask( | 424 base::ThreadTaskRunnerHandle::Get()->PostTask( |
425 FROM_HERE, | 425 FROM_HERE, |
426 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, | 426 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, |
427 client_ptr_factory_->GetWeakPtr(), bitstream_buffer.id(), size, | 427 client_ptr_factory_->GetWeakPtr(), bitstream_buffer.id(), size, |
428 key_frame, base::Time::Now() - base::Time())); | 428 key_frame, base::Time::Now() - base::Time())); |
429 } | 429 } |
430 | 430 |
431 } // namespace media | 431 } // namespace media |
OLD | NEW |