| 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 <string.h> | 7 #include <string.h> | 
| 8 | 8 | 
| 9 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 10 #include "base/location.h" | 10 #include "base/location.h" | 
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 502   input_next_frame_keyframe_ = false; | 502   input_next_frame_keyframe_ = false; | 
| 503 | 503 | 
| 504   if (!video_encoder_) { | 504   if (!video_encoder_) { | 
| 505     SignalAsyncWaiter(WEBRTC_VIDEO_CODEC_ERROR); | 505     SignalAsyncWaiter(WEBRTC_VIDEO_CODEC_ERROR); | 
| 506     return; | 506     return; | 
| 507   } | 507   } | 
| 508 | 508 | 
| 509   const int index = input_buffers_free_.back(); | 509   const int index = input_buffers_free_.back(); | 
| 510   bool requires_copy = false; | 510   bool requires_copy = false; | 
| 511   scoped_refptr<media::VideoFrame> frame; | 511   scoped_refptr<media::VideoFrame> frame; | 
| 512   if (next_frame->native_handle()) { | 512   if (next_frame->video_frame_buffer()->native_handle()) { | 
| 513     frame = static_cast<media::VideoFrame*>(next_frame->native_handle()); | 513     frame = static_cast<media::VideoFrame*>( | 
|  | 514         next_frame->video_frame_buffer()->native_handle()); | 
| 514     requires_copy = RequiresSizeChange(frame); | 515     requires_copy = RequiresSizeChange(frame); | 
| 515   } else { | 516   } else { | 
| 516     requires_copy = true; | 517     requires_copy = true; | 
| 517   } | 518   } | 
| 518 | 519 | 
| 519   if (requires_copy) { | 520   if (requires_copy) { | 
| 520     base::SharedMemory* input_buffer = input_buffers_[index]; | 521     base::SharedMemory* input_buffer = input_buffers_[index]; | 
| 521     frame = media::VideoFrame::WrapExternalSharedMemory( | 522     frame = media::VideoFrame::WrapExternalSharedMemory( | 
| 522         media::PIXEL_FORMAT_I420, input_frame_coded_size_, | 523         media::PIXEL_FORMAT_I420, input_frame_coded_size_, | 
| 523         gfx::Rect(input_visible_size_), input_visible_size_, | 524         gfx::Rect(input_visible_size_), input_visible_size_, | 
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 806   UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", | 807   UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", | 
| 807                         init_retval == WEBRTC_VIDEO_CODEC_OK); | 808                         init_retval == WEBRTC_VIDEO_CODEC_OK); | 
| 808   if (init_retval == WEBRTC_VIDEO_CODEC_OK) { | 809   if (init_retval == WEBRTC_VIDEO_CODEC_OK) { | 
| 809     UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", | 810     UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", | 
| 810                               profile, | 811                               profile, | 
| 811                               media::VIDEO_CODEC_PROFILE_MAX + 1); | 812                               media::VIDEO_CODEC_PROFILE_MAX + 1); | 
| 812   } | 813   } | 
| 813 } | 814 } | 
| 814 | 815 | 
| 815 }  // namespace content | 816 }  // namespace content | 
| OLD | NEW | 
|---|