Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: content/renderer/media/rtc_video_encoder.cc

Issue 1547073003: Switch to standard integer types in content/renderer/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/macros.h"
10 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
11 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
12 #include "base/numerics/safe_conversions.h" 13 #include "base/numerics/safe_conversions.h"
13 #include "base/rand_util.h" 14 #include "base/rand_util.h"
14 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
15 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
16 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
17 #include "media/base/bind_to_current_loop.h" 18 #include "media/base/bind_to_current_loop.h"
18 #include "media/base/bitstream_buffer.h" 19 #include "media/base/bitstream_buffer.h"
19 #include "media/base/video_frame.h" 20 #include "media/base/video_frame.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 public: 103 public:
103 Impl(const base::WeakPtr<RTCVideoEncoder>& weak_encoder, 104 Impl(const base::WeakPtr<RTCVideoEncoder>& weak_encoder,
104 media::GpuVideoAcceleratorFactories* gpu_factories); 105 media::GpuVideoAcceleratorFactories* gpu_factories);
105 106
106 // Create the VEA and call Initialize() on it. Called once per instantiation, 107 // Create the VEA and call Initialize() on it. Called once per instantiation,
107 // and then the instance is bound forevermore to whichever thread made the 108 // and then the instance is bound forevermore to whichever thread made the
108 // call. 109 // call.
109 // RTCVideoEncoder expects to be able to call this function synchronously from 110 // RTCVideoEncoder expects to be able to call this function synchronously from
110 // its own thread, hence the |async_waiter| and |async_retval| arguments. 111 // its own thread, hence the |async_waiter| and |async_retval| arguments.
111 void CreateAndInitializeVEA(const gfx::Size& input_visible_size, 112 void CreateAndInitializeVEA(const gfx::Size& input_visible_size,
112 uint32 bitrate, 113 uint32_t bitrate,
113 media::VideoCodecProfile profile, 114 media::VideoCodecProfile profile,
114 base::WaitableEvent* async_waiter, 115 base::WaitableEvent* async_waiter,
115 int32_t* async_retval); 116 int32_t* async_retval);
116 // Enqueue a frame from WebRTC for encoding. 117 // Enqueue a frame from WebRTC for encoding.
117 // RTCVideoEncoder expects to be able to call this function synchronously from 118 // RTCVideoEncoder expects to be able to call this function synchronously from
118 // its own thread, hence the |async_waiter| and |async_retval| arguments. 119 // its own thread, hence the |async_waiter| and |async_retval| arguments.
119 void Enqueue(const webrtc::VideoFrame* input_frame, 120 void Enqueue(const webrtc::VideoFrame* input_frame,
120 bool force_keyframe, 121 bool force_keyframe,
121 base::WaitableEvent* async_waiter, 122 base::WaitableEvent* async_waiter,
122 int32_t* async_retval); 123 int32_t* async_retval);
123 124
124 // RTCVideoEncoder is given a buffer to be passed to WebRTC through the 125 // RTCVideoEncoder is given a buffer to be passed to WebRTC through the
125 // RTCVideoEncoder::ReturnEncodedImage() function. When that is complete, 126 // RTCVideoEncoder::ReturnEncodedImage() function. When that is complete,
126 // the buffer is returned to Impl by its index using this function. 127 // the buffer is returned to Impl by its index using this function.
127 void UseOutputBitstreamBufferId(int32 bitstream_buffer_id); 128 void UseOutputBitstreamBufferId(int32_t bitstream_buffer_id);
128 129
129 // Request encoding parameter change for the underlying encoder. 130 // Request encoding parameter change for the underlying encoder.
130 void RequestEncodingParametersChange(uint32 bitrate, uint32 framerate); 131 void RequestEncodingParametersChange(uint32_t bitrate, uint32_t framerate);
131 132
132 // Destroy this Impl's encoder. The destructor is not explicitly called, as 133 // Destroy this Impl's encoder. The destructor is not explicitly called, as
133 // Impl is a base::RefCountedThreadSafe. 134 // Impl is a base::RefCountedThreadSafe.
134 void Destroy(); 135 void Destroy();
135 136
136 // media::VideoEncodeAccelerator::Client implementation. 137 // media::VideoEncodeAccelerator::Client implementation.
137 void RequireBitstreamBuffers(unsigned int input_count, 138 void RequireBitstreamBuffers(unsigned int input_count,
138 const gfx::Size& input_coded_size, 139 const gfx::Size& input_coded_size,
139 size_t output_buffer_size) override; 140 size_t output_buffer_size) override;
140 void BitstreamBufferReady(int32 bitstream_buffer_id, 141 void BitstreamBufferReady(int32_t bitstream_buffer_id,
141 size_t payload_size, 142 size_t payload_size,
142 bool key_frame) override; 143 bool key_frame) override;
143 void NotifyError(media::VideoEncodeAccelerator::Error error) override; 144 void NotifyError(media::VideoEncodeAccelerator::Error error) override;
144 145
145 private: 146 private:
146 friend class base::RefCountedThreadSafe<Impl>; 147 friend class base::RefCountedThreadSafe<Impl>;
147 148
148 enum { 149 enum {
149 kInputBufferExtraCount = 1, // The number of input buffers allocated, more 150 kInputBufferExtraCount = 1, // The number of input buffers allocated, more
150 // than what is requested by 151 // than what is requested by
(...skipping 13 matching lines...) Expand all
164 165
165 // Notify that an input frame is finished for encoding. |index| is the index 166 // Notify that an input frame is finished for encoding. |index| is the index
166 // of the completed frame in |input_buffers_|. 167 // of the completed frame in |input_buffers_|.
167 void EncodeFrameFinished(int index); 168 void EncodeFrameFinished(int index);
168 169
169 // Set up/signal |async_waiter_| and |async_retval_|; see declarations below. 170 // Set up/signal |async_waiter_| and |async_retval_|; see declarations below.
170 void RegisterAsyncWaiter(base::WaitableEvent* waiter, int32_t* retval); 171 void RegisterAsyncWaiter(base::WaitableEvent* waiter, int32_t* retval);
171 void SignalAsyncWaiter(int32_t retval); 172 void SignalAsyncWaiter(int32_t retval);
172 173
173 // Checks if the bitrate would overflow when passing from kbps to bps. 174 // Checks if the bitrate would overflow when passing from kbps to bps.
174 bool IsBitrateTooHigh(uint32 bitrate); 175 bool IsBitrateTooHigh(uint32_t bitrate);
175 176
176 base::ThreadChecker thread_checker_; 177 base::ThreadChecker thread_checker_;
177 178
178 // Weak pointer to the parent RTCVideoEncoder, for posting back VEA::Client 179 // Weak pointer to the parent RTCVideoEncoder, for posting back VEA::Client
179 // notifications. 180 // notifications.
180 const base::WeakPtr<RTCVideoEncoder> weak_encoder_; 181 const base::WeakPtr<RTCVideoEncoder> weak_encoder_;
181 182
182 // The message loop on which to post callbacks to |weak_encoder_|. 183 // The message loop on which to post callbacks to |weak_encoder_|.
183 const scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner_; 184 const scoped_refptr<base::SingleThreadTaskRunner> encoder_task_runner_;
184 185
(...skipping 27 matching lines...) Expand all
212 213
213 // Input buffers ready to be filled with input from Encode(). As a LIFO since 214 // Input buffers ready to be filled with input from Encode(). As a LIFO since
214 // we don't care about ordering. 215 // we don't care about ordering.
215 std::vector<int> input_buffers_free_; 216 std::vector<int> input_buffers_free_;
216 217
217 // The number of output buffers ready to be filled with output from the 218 // The number of output buffers ready to be filled with output from the
218 // encoder. 219 // encoder.
219 int output_buffers_free_count_; 220 int output_buffers_free_count_;
220 221
221 // 15 bits running index of the VP8 frames. See VP8 RTP spec for details. 222 // 15 bits running index of the VP8 frames. See VP8 RTP spec for details.
222 uint16 picture_id_; 223 uint16_t picture_id_;
223 224
224 DISALLOW_COPY_AND_ASSIGN(Impl); 225 DISALLOW_COPY_AND_ASSIGN(Impl);
225 }; 226 };
226 227
227 RTCVideoEncoder::Impl::Impl(const base::WeakPtr<RTCVideoEncoder>& weak_encoder, 228 RTCVideoEncoder::Impl::Impl(const base::WeakPtr<RTCVideoEncoder>& weak_encoder,
228 media::GpuVideoAcceleratorFactories* gpu_factories) 229 media::GpuVideoAcceleratorFactories* gpu_factories)
229 : weak_encoder_(weak_encoder), 230 : weak_encoder_(weak_encoder),
230 encoder_task_runner_(base::ThreadTaskRunnerHandle::Get()), 231 encoder_task_runner_(base::ThreadTaskRunnerHandle::Get()),
231 gpu_factories_(gpu_factories), 232 gpu_factories_(gpu_factories),
232 async_waiter_(NULL), 233 async_waiter_(NULL),
233 async_retval_(NULL), 234 async_retval_(NULL),
234 input_next_frame_(NULL), 235 input_next_frame_(NULL),
235 input_next_frame_keyframe_(false), 236 input_next_frame_keyframe_(false),
236 output_buffers_free_count_(0) { 237 output_buffers_free_count_(0) {
237 thread_checker_.DetachFromThread(); 238 thread_checker_.DetachFromThread();
238 // Picture ID should start on a random number. 239 // Picture ID should start on a random number.
239 picture_id_ = static_cast<uint16_t>(base::RandInt(0, 0x7FFF)); 240 picture_id_ = static_cast<uint16_t>(base::RandInt(0, 0x7FFF));
240 } 241 }
241 242
242 void RTCVideoEncoder::Impl::CreateAndInitializeVEA( 243 void RTCVideoEncoder::Impl::CreateAndInitializeVEA(
243 const gfx::Size& input_visible_size, 244 const gfx::Size& input_visible_size,
244 uint32 bitrate, 245 uint32_t bitrate,
245 media::VideoCodecProfile profile, 246 media::VideoCodecProfile profile,
246 base::WaitableEvent* async_waiter, 247 base::WaitableEvent* async_waiter,
247 int32_t* async_retval) { 248 int32_t* async_retval) {
248 DVLOG(3) << "Impl::CreateAndInitializeVEA()"; 249 DVLOG(3) << "Impl::CreateAndInitializeVEA()";
249 DCHECK(thread_checker_.CalledOnValidThread()); 250 DCHECK(thread_checker_.CalledOnValidThread());
250 251
251 RegisterAsyncWaiter(async_waiter, async_retval); 252 RegisterAsyncWaiter(async_waiter, async_retval);
252 253
253 // Check for overflow converting bitrate (kilobits/sec) to bits/sec. 254 // Check for overflow converting bitrate (kilobits/sec) to bits/sec.
254 if (IsBitrateTooHigh(bitrate)) 255 if (IsBitrateTooHigh(bitrate))
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return; 303 return;
303 } 304 }
304 input_next_frame_ = input_frame; 305 input_next_frame_ = input_frame;
305 input_next_frame_keyframe_ = force_keyframe; 306 input_next_frame_keyframe_ = force_keyframe;
306 307
307 if (!input_buffers_free_.empty()) 308 if (!input_buffers_free_.empty())
308 EncodeOneFrame(); 309 EncodeOneFrame();
309 } 310 }
310 311
311 void RTCVideoEncoder::Impl::UseOutputBitstreamBufferId( 312 void RTCVideoEncoder::Impl::UseOutputBitstreamBufferId(
312 int32 bitstream_buffer_id) { 313 int32_t bitstream_buffer_id) {
313 DVLOG(3) << "Impl::UseOutputBitstreamBufferIndex(): " 314 DVLOG(3) << "Impl::UseOutputBitstreamBufferIndex(): "
314 "bitstream_buffer_id=" << bitstream_buffer_id; 315 "bitstream_buffer_id=" << bitstream_buffer_id;
315 DCHECK(thread_checker_.CalledOnValidThread()); 316 DCHECK(thread_checker_.CalledOnValidThread());
316 if (video_encoder_) { 317 if (video_encoder_) {
317 video_encoder_->UseOutputBitstreamBuffer(media::BitstreamBuffer( 318 video_encoder_->UseOutputBitstreamBuffer(media::BitstreamBuffer(
318 bitstream_buffer_id, 319 bitstream_buffer_id,
319 output_buffers_[bitstream_buffer_id]->handle(), 320 output_buffers_[bitstream_buffer_id]->handle(),
320 output_buffers_[bitstream_buffer_id]->mapped_size())); 321 output_buffers_[bitstream_buffer_id]->mapped_size()));
321 output_buffers_free_count_++; 322 output_buffers_free_count_++;
322 } 323 }
323 } 324 }
324 325
325 void RTCVideoEncoder::Impl::RequestEncodingParametersChange(uint32 bitrate, 326 void RTCVideoEncoder::Impl::RequestEncodingParametersChange(
326 uint32 framerate) { 327 uint32_t bitrate,
328 uint32_t framerate) {
327 DVLOG(3) << "Impl::RequestEncodingParametersChange(): bitrate=" << bitrate 329 DVLOG(3) << "Impl::RequestEncodingParametersChange(): bitrate=" << bitrate
328 << ", framerate=" << framerate; 330 << ", framerate=" << framerate;
329 DCHECK(thread_checker_.CalledOnValidThread()); 331 DCHECK(thread_checker_.CalledOnValidThread());
330 332
331 // Check for overflow converting bitrate (kilobits/sec) to bits/sec. 333 // Check for overflow converting bitrate (kilobits/sec) to bits/sec.
332 if (IsBitrateTooHigh(bitrate)) 334 if (IsBitrateTooHigh(bitrate))
333 return; 335 return;
334 336
335 if (video_encoder_) 337 if (video_encoder_)
336 video_encoder_->RequestEncodingParametersChange(bitrate * 1000, framerate); 338 video_encoder_->RequestEncodingParametersChange(bitrate * 1000, framerate);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 384
383 // Immediately provide all output buffers to the VEA. 385 // Immediately provide all output buffers to the VEA.
384 for (size_t i = 0; i < output_buffers_.size(); ++i) { 386 for (size_t i = 0; i < output_buffers_.size(); ++i) {
385 video_encoder_->UseOutputBitstreamBuffer(media::BitstreamBuffer( 387 video_encoder_->UseOutputBitstreamBuffer(media::BitstreamBuffer(
386 i, output_buffers_[i]->handle(), output_buffers_[i]->mapped_size())); 388 i, output_buffers_[i]->handle(), output_buffers_[i]->mapped_size()));
387 output_buffers_free_count_++; 389 output_buffers_free_count_++;
388 } 390 }
389 SignalAsyncWaiter(WEBRTC_VIDEO_CODEC_OK); 391 SignalAsyncWaiter(WEBRTC_VIDEO_CODEC_OK);
390 } 392 }
391 393
392 void RTCVideoEncoder::Impl::BitstreamBufferReady(int32 bitstream_buffer_id, 394 void RTCVideoEncoder::Impl::BitstreamBufferReady(int32_t bitstream_buffer_id,
393 size_t payload_size, 395 size_t payload_size,
394 bool key_frame) { 396 bool key_frame) {
395 DVLOG(3) << "Impl::BitstreamBufferReady(): " 397 DVLOG(3) << "Impl::BitstreamBufferReady(): "
396 "bitstream_buffer_id=" << bitstream_buffer_id 398 "bitstream_buffer_id=" << bitstream_buffer_id
397 << ", payload_size=" << payload_size 399 << ", payload_size=" << payload_size
398 << ", key_frame=" << key_frame; 400 << ", key_frame=" << key_frame;
399 DCHECK(thread_checker_.CalledOnValidThread()); 401 DCHECK(thread_checker_.CalledOnValidThread());
400 402
401 if (bitstream_buffer_id < 0 || 403 if (bitstream_buffer_id < 0 ||
402 bitstream_buffer_id >= static_cast<int>(output_buffers_.size())) { 404 bitstream_buffer_id >= static_cast<int>(output_buffers_.size())) {
403 LogAndNotifyError(FROM_HERE, "invalid bitstream_buffer_id", 405 LogAndNotifyError(FROM_HERE, "invalid bitstream_buffer_id",
404 media::VideoEncodeAccelerator::kPlatformFailureError); 406 media::VideoEncodeAccelerator::kPlatformFailureError);
405 return; 407 return;
406 } 408 }
407 base::SharedMemory* output_buffer = output_buffers_[bitstream_buffer_id]; 409 base::SharedMemory* output_buffer = output_buffers_[bitstream_buffer_id];
408 if (payload_size > output_buffer->mapped_size()) { 410 if (payload_size > output_buffer->mapped_size()) {
409 LogAndNotifyError(FROM_HERE, "invalid payload_size", 411 LogAndNotifyError(FROM_HERE, "invalid payload_size",
410 media::VideoEncodeAccelerator::kPlatformFailureError); 412 media::VideoEncodeAccelerator::kPlatformFailureError);
411 return; 413 return;
412 } 414 }
413 output_buffers_free_count_--; 415 output_buffers_free_count_--;
414 416
415 // Use webrtc timestamps to ensure correct RTP sender behavior. 417 // Use webrtc timestamps to ensure correct RTP sender behavior.
416 // TODO(hshi): obtain timestamp from the capturer, see crbug.com/350106. 418 // TODO(hshi): obtain timestamp from the capturer, see crbug.com/350106.
417 const int64 capture_time_us = webrtc::TickTime::MicrosecondTimestamp(); 419 const int64_t capture_time_us = webrtc::TickTime::MicrosecondTimestamp();
418 420
419 // Derive the capture time (in ms) and RTP timestamp (in 90KHz ticks). 421 // Derive the capture time (in ms) and RTP timestamp (in 90KHz ticks).
420 const int64 capture_time_ms = capture_time_us / 1000; 422 const int64_t capture_time_ms = capture_time_us / 1000;
421 const uint32_t rtp_timestamp = 423 const uint32_t rtp_timestamp =
422 static_cast<uint32_t>(capture_time_us * 90 / 1000); 424 static_cast<uint32_t>(capture_time_us * 90 / 1000);
423 425
424 scoped_ptr<webrtc::EncodedImage> image(new webrtc::EncodedImage( 426 scoped_ptr<webrtc::EncodedImage> image(new webrtc::EncodedImage(
425 reinterpret_cast<uint8_t*>(output_buffer->memory()), 427 reinterpret_cast<uint8_t*>(output_buffer->memory()),
426 payload_size, 428 payload_size,
427 output_buffer->mapped_size())); 429 output_buffer->mapped_size()));
428 image->_encodedWidth = input_visible_size_.width(); 430 image->_encodedWidth = input_visible_size_.width();
429 image->_encodedHeight = input_visible_size_.height(); 431 image->_encodedHeight = input_visible_size_.height();
430 image->_timeStamp = rtp_timestamp; 432 image->_timeStamp = rtp_timestamp;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 503
502 const int index = input_buffers_free_.back(); 504 const int index = input_buffers_free_.back();
503 scoped_refptr<media::VideoFrame> frame; 505 scoped_refptr<media::VideoFrame> frame;
504 if (next_frame->native_handle()) { 506 if (next_frame->native_handle()) {
505 frame = static_cast<media::VideoFrame*>(next_frame->native_handle()); 507 frame = static_cast<media::VideoFrame*>(next_frame->native_handle());
506 } else { 508 } else {
507 base::SharedMemory* input_buffer = input_buffers_[index]; 509 base::SharedMemory* input_buffer = input_buffers_[index];
508 frame = media::VideoFrame::WrapExternalSharedMemory( 510 frame = media::VideoFrame::WrapExternalSharedMemory(
509 media::PIXEL_FORMAT_I420, input_frame_coded_size_, 511 media::PIXEL_FORMAT_I420, input_frame_coded_size_,
510 gfx::Rect(input_visible_size_), input_visible_size_, 512 gfx::Rect(input_visible_size_), input_visible_size_,
511 reinterpret_cast<uint8*>(input_buffer->memory()), 513 reinterpret_cast<uint8_t*>(input_buffer->memory()),
512 input_buffer->mapped_size(), input_buffer->handle(), 0, 514 input_buffer->mapped_size(), input_buffer->handle(), 0,
513 base::TimeDelta()); 515 base::TimeDelta());
514 if (!frame.get()) { 516 if (!frame.get()) {
515 LogAndNotifyError(FROM_HERE, "failed to create frame", 517 LogAndNotifyError(FROM_HERE, "failed to create frame",
516 media::VideoEncodeAccelerator::kPlatformFailureError); 518 media::VideoEncodeAccelerator::kPlatformFailureError);
517 return; 519 return;
518 } 520 }
519 // Do a strided copy of the input frame to match the input requirements for 521 // Do a strided copy of the input frame to match the input requirements for
520 // the encoder. 522 // the encoder.
521 // TODO(sheu): support zero-copy from WebRTC. http://crbug.com/269312 523 // TODO(sheu): support zero-copy from WebRTC. http://crbug.com/269312
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 } 566 }
565 567
566 void RTCVideoEncoder::Impl::SignalAsyncWaiter(int32_t retval) { 568 void RTCVideoEncoder::Impl::SignalAsyncWaiter(int32_t retval) {
567 DCHECK(thread_checker_.CalledOnValidThread()); 569 DCHECK(thread_checker_.CalledOnValidThread());
568 *async_retval_ = retval; 570 *async_retval_ = retval;
569 async_waiter_->Signal(); 571 async_waiter_->Signal();
570 async_retval_ = NULL; 572 async_retval_ = NULL;
571 async_waiter_ = NULL; 573 async_waiter_ = NULL;
572 } 574 }
573 575
574 bool RTCVideoEncoder::Impl::IsBitrateTooHigh(uint32 bitrate) { 576 bool RTCVideoEncoder::Impl::IsBitrateTooHigh(uint32_t bitrate) {
575 if (base::IsValueInRangeForNumericType<uint32>(bitrate * UINT64_C(1000))) 577 if (base::IsValueInRangeForNumericType<uint32_t>(bitrate * UINT64_C(1000)))
576 return false; 578 return false;
577 LogAndNotifyError(FROM_HERE, "Overflow converting bitrate from kbps to bps", 579 LogAndNotifyError(FROM_HERE, "Overflow converting bitrate from kbps to bps",
578 media::VideoEncodeAccelerator::kInvalidArgumentError); 580 media::VideoEncodeAccelerator::kInvalidArgumentError);
579 return true; 581 return true;
580 } 582 }
581 583
582 RTCVideoEncoder::RTCVideoEncoder( 584 RTCVideoEncoder::RTCVideoEncoder(
583 webrtc::VideoCodecType type, 585 webrtc::VideoCodecType type,
584 media::GpuVideoAcceleratorFactories* gpu_factories) 586 media::GpuVideoAcceleratorFactories* gpu_factories)
585 : video_codec_type_(type), 587 : video_codec_type_(type),
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 gpu_task_runner_->PostTask( 708 gpu_task_runner_->PostTask(
707 FROM_HERE, 709 FROM_HERE,
708 base::Bind(&RTCVideoEncoder::Impl::RequestEncodingParametersChange, 710 base::Bind(&RTCVideoEncoder::Impl::RequestEncodingParametersChange,
709 impl_, 711 impl_,
710 new_bit_rate, 712 new_bit_rate,
711 frame_rate)); 713 frame_rate));
712 return WEBRTC_VIDEO_CODEC_OK; 714 return WEBRTC_VIDEO_CODEC_OK;
713 } 715 }
714 716
715 void RTCVideoEncoder::ReturnEncodedImage(scoped_ptr<webrtc::EncodedImage> image, 717 void RTCVideoEncoder::ReturnEncodedImage(scoped_ptr<webrtc::EncodedImage> image,
716 int32 bitstream_buffer_id, 718 int32_t bitstream_buffer_id,
717 uint16 picture_id) { 719 uint16_t picture_id) {
718 DCHECK(thread_checker_.CalledOnValidThread()); 720 DCHECK(thread_checker_.CalledOnValidThread());
719 DVLOG(3) << "ReturnEncodedImage(): " 721 DVLOG(3) << "ReturnEncodedImage(): "
720 << "bitstream_buffer_id=" << bitstream_buffer_id 722 << "bitstream_buffer_id=" << bitstream_buffer_id
721 << ", picture_id=" << picture_id; 723 << ", picture_id=" << picture_id;
722 724
723 if (!encoded_image_callback_) 725 if (!encoded_image_callback_)
724 return; 726 return;
725 727
726 webrtc::RTPFragmentationHeader header; 728 webrtc::RTPFragmentationHeader header;
727 memset(&header, 0, sizeof(header)); 729 memset(&header, 0, sizeof(header));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", 788 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess",
787 init_retval == WEBRTC_VIDEO_CODEC_OK); 789 init_retval == WEBRTC_VIDEO_CODEC_OK);
788 if (init_retval == WEBRTC_VIDEO_CODEC_OK) { 790 if (init_retval == WEBRTC_VIDEO_CODEC_OK) {
789 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", 791 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile",
790 profile, 792 profile,
791 media::VIDEO_CODEC_PROFILE_MAX + 1); 793 media::VIDEO_CODEC_PROFILE_MAX + 1);
792 } 794 }
793 } 795 }
794 796
795 } // namespace content 797 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_encoder.h ('k') | content/renderer/media/rtc_video_encoder_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698