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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 DCHECK(thread_checker_.CalledOnValidThread()); | 174 DCHECK(thread_checker_.CalledOnValidThread()); |
175 | 175 |
176 RegisterAsyncWaiter(async_waiter, async_retval); | 176 RegisterAsyncWaiter(async_waiter, async_retval); |
177 | 177 |
178 // Check for overflow converting bitrate (kilobits/sec) to bits/sec. | 178 // Check for overflow converting bitrate (kilobits/sec) to bits/sec. |
179 if (bitrate > kuint32max / 1000) { | 179 if (bitrate > kuint32max / 1000) { |
180 NOTIFY_ERROR(media::VideoEncodeAccelerator::kInvalidArgumentError); | 180 NOTIFY_ERROR(media::VideoEncodeAccelerator::kInvalidArgumentError); |
181 return; | 181 return; |
182 } | 182 } |
183 | 183 |
184 video_encoder_ = gpu_factories_->CreateVideoEncodeAccelerator(this).Pass(); | 184 video_encoder_ = gpu_factories_->CreateVideoEncodeAccelerator().Pass(); |
185 if (!video_encoder_) { | 185 if (!video_encoder_) { |
186 NOTIFY_ERROR(media::VideoEncodeAccelerator::kPlatformFailureError); | 186 NOTIFY_ERROR(media::VideoEncodeAccelerator::kPlatformFailureError); |
187 return; | 187 return; |
188 } | 188 } |
189 input_visible_size_ = input_visible_size; | 189 input_visible_size_ = input_visible_size; |
190 video_encoder_->Initialize( | 190 video_encoder_->Initialize(this, |
191 media::VideoFrame::I420, input_visible_size_, profile, bitrate * 1000); | 191 media::VideoFrame::I420, |
| 192 input_visible_size_, |
| 193 profile, |
| 194 bitrate * 1000); |
192 } | 195 } |
193 | 196 |
194 void RTCVideoEncoder::Impl::Enqueue(const webrtc::I420VideoFrame* input_frame, | 197 void RTCVideoEncoder::Impl::Enqueue(const webrtc::I420VideoFrame* input_frame, |
195 bool force_keyframe, | 198 bool force_keyframe, |
196 base::WaitableEvent* async_waiter, | 199 base::WaitableEvent* async_waiter, |
197 int32_t* async_retval) { | 200 int32_t* async_retval) { |
198 DVLOG(3) << "Impl::Enqueue()"; | 201 DVLOG(3) << "Impl::Enqueue()"; |
199 DCHECK(thread_checker_.CalledOnValidThread()); | 202 DCHECK(thread_checker_.CalledOnValidThread()); |
200 DCHECK(!input_next_frame_); | 203 DCHECK(!input_next_frame_); |
201 | 204 |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", | 656 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", |
654 init_retval == WEBRTC_VIDEO_CODEC_OK); | 657 init_retval == WEBRTC_VIDEO_CODEC_OK); |
655 if (init_retval == WEBRTC_VIDEO_CODEC_OK) { | 658 if (init_retval == WEBRTC_VIDEO_CODEC_OK) { |
656 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", | 659 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", |
657 video_codec_profile_, | 660 video_codec_profile_, |
658 media::VIDEO_CODEC_PROFILE_MAX); | 661 media::VIDEO_CODEC_PROFILE_MAX); |
659 } | 662 } |
660 } | 663 } |
661 | 664 |
662 } // namespace content | 665 } // namespace content |
OLD | NEW |