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 "content/renderer/media/rtc_video_encoder.h" | 5 #include "content/renderer/media/rtc_video_encoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 return; | 272 return; |
273 } | 273 } |
274 | 274 |
275 if (video_encoder_) | 275 if (video_encoder_) |
276 video_encoder_->RequestEncodingParametersChange(bitrate * 1000, framerate); | 276 video_encoder_->RequestEncodingParametersChange(bitrate * 1000, framerate); |
277 } | 277 } |
278 | 278 |
279 void RTCVideoEncoder::Impl::Destroy() { | 279 void RTCVideoEncoder::Impl::Destroy() { |
280 DVLOG(3) << "Impl::Destroy()"; | 280 DVLOG(3) << "Impl::Destroy()"; |
281 DCHECK(thread_checker_.CalledOnValidThread()); | 281 DCHECK(thread_checker_.CalledOnValidThread()); |
282 if (video_encoder_) | 282 video_encoder_.reset(); |
283 video_encoder_.release()->Destroy(); | |
284 } | 283 } |
285 | 284 |
286 void RTCVideoEncoder::Impl::RequireBitstreamBuffers( | 285 void RTCVideoEncoder::Impl::RequireBitstreamBuffers( |
287 unsigned int input_count, | 286 unsigned int input_count, |
288 const gfx::Size& input_coded_size, | 287 const gfx::Size& input_coded_size, |
289 size_t output_buffer_size) { | 288 size_t output_buffer_size) { |
290 DVLOG(3) << "Impl::RequireBitstreamBuffers(): input_count=" << input_count | 289 DVLOG(3) << "Impl::RequireBitstreamBuffers(): input_count=" << input_count |
291 << ", input_coded_size=" << input_coded_size.ToString() | 290 << ", input_coded_size=" << input_coded_size.ToString() |
292 << ", output_buffer_size=" << output_buffer_size; | 291 << ", output_buffer_size=" << output_buffer_size; |
293 DCHECK(thread_checker_.CalledOnValidThread()); | 292 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 DCHECK(thread_checker_.CalledOnValidThread()); | 392 DCHECK(thread_checker_.CalledOnValidThread()); |
394 int32_t retval; | 393 int32_t retval; |
395 switch (error) { | 394 switch (error) { |
396 case media::VideoEncodeAccelerator::kInvalidArgumentError: | 395 case media::VideoEncodeAccelerator::kInvalidArgumentError: |
397 retval = WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | 396 retval = WEBRTC_VIDEO_CODEC_ERR_PARAMETER; |
398 break; | 397 break; |
399 default: | 398 default: |
400 retval = WEBRTC_VIDEO_CODEC_ERROR; | 399 retval = WEBRTC_VIDEO_CODEC_ERROR; |
401 } | 400 } |
402 | 401 |
403 if (video_encoder_) | 402 video_encoder_.reset(); |
404 video_encoder_.release()->Destroy(); | |
405 | 403 |
406 if (async_waiter_) { | 404 if (async_waiter_) { |
407 SignalAsyncWaiter(retval); | 405 SignalAsyncWaiter(retval); |
408 } else { | 406 } else { |
409 encoder_message_loop_proxy_->PostTask( | 407 encoder_message_loop_proxy_->PostTask( |
410 FROM_HERE, | 408 FROM_HERE, |
411 base::Bind(&RTCVideoEncoder::NotifyError, weak_encoder_, retval)); | 409 base::Bind(&RTCVideoEncoder::NotifyError, weak_encoder_, retval)); |
412 } | 410 } |
413 } | 411 } |
414 | 412 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", | 698 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", |
701 init_retval == WEBRTC_VIDEO_CODEC_OK); | 699 init_retval == WEBRTC_VIDEO_CODEC_OK); |
702 if (init_retval == WEBRTC_VIDEO_CODEC_OK) { | 700 if (init_retval == WEBRTC_VIDEO_CODEC_OK) { |
703 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", | 701 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", |
704 video_codec_profile_, | 702 video_codec_profile_, |
705 media::VIDEO_CODEC_PROFILE_MAX + 1); | 703 media::VIDEO_CODEC_PROFILE_MAX + 1); |
706 } | 704 } |
707 } | 705 } |
708 | 706 |
709 } // namespace content | 707 } // namespace content |
OLD | NEW |