| 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/gpu/rtc_video_encoder.h" |    5 #include "content/renderer/media/gpu/rtc_video_encoder.h" | 
|    6  |    6  | 
|    7 #include <string.h> |    7 #include <string.h> | 
|    8  |    8  | 
|    9 #include <deque> |    9 #include <deque> | 
|   10 #include <memory> |   10 #include <memory> | 
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  611     frame = static_cast<WebRtcVideoFrameAdapter*>( |  611     frame = static_cast<WebRtcVideoFrameAdapter*>( | 
|  612                 next_frame->video_frame_buffer().get()) |  612                 next_frame->video_frame_buffer().get()) | 
|  613                 ->getMediaVideoFrame(); |  613                 ->getMediaVideoFrame(); | 
|  614     requires_copy = RequiresSizeChange(frame) || |  614     requires_copy = RequiresSizeChange(frame) || | 
|  615                     frame->storage_type() != media::VideoFrame::STORAGE_SHMEM; |  615                     frame->storage_type() != media::VideoFrame::STORAGE_SHMEM; | 
|  616   } else { |  616   } else { | 
|  617     requires_copy = true; |  617     requires_copy = true; | 
|  618   } |  618   } | 
|  619  |  619  | 
|  620   if (requires_copy) { |  620   if (requires_copy) { | 
 |  621     // TODO(magjed/emircan): This check is needed in order for the | 
 |  622     // |pending_timestamps_| DHCECK below to not fail. It shouldn't be | 
 |  623     // necessary. | 
 |  624     const bool use_media_timestamp = | 
 |  625         frame && (frame->HasTextures() || | 
 |  626                   frame->storage_type() == media::VideoFrame::STORAGE_SHMEM); | 
|  621     const base::TimeDelta timestamp = |  627     const base::TimeDelta timestamp = | 
|  622         frame ? frame->timestamp() |  628         use_media_timestamp | 
|  623               : base::TimeDelta::FromMilliseconds(next_frame->ntp_time_ms()); |  629             ? frame->timestamp() | 
 |  630             : base::TimeDelta::FromMilliseconds(next_frame->ntp_time_ms()); | 
|  624     base::SharedMemory* input_buffer = input_buffers_[index].get(); |  631     base::SharedMemory* input_buffer = input_buffers_[index].get(); | 
|  625     frame = media::VideoFrame::WrapExternalSharedMemory( |  632     frame = media::VideoFrame::WrapExternalSharedMemory( | 
|  626         media::PIXEL_FORMAT_I420, input_frame_coded_size_, |  633         media::PIXEL_FORMAT_I420, input_frame_coded_size_, | 
|  627         gfx::Rect(input_visible_size_), input_visible_size_, |  634         gfx::Rect(input_visible_size_), input_visible_size_, | 
|  628         reinterpret_cast<uint8_t*>(input_buffer->memory()), |  635         reinterpret_cast<uint8_t*>(input_buffer->memory()), | 
|  629         input_buffer->mapped_size(), input_buffer->handle(), 0, timestamp); |  636         input_buffer->mapped_size(), input_buffer->handle(), 0, timestamp); | 
|  630     if (!frame.get()) { |  637     if (!frame.get()) { | 
|  631       LogAndNotifyError(FROM_HERE, "failed to create frame", |  638       LogAndNotifyError(FROM_HERE, "failed to create frame", | 
|  632                         media::VideoEncodeAccelerator::kPlatformFailureError); |  639                         media::VideoEncodeAccelerator::kPlatformFailureError); | 
|  633       return; |  640       return; | 
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  938   UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", |  945   UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", | 
|  939                         init_retval == WEBRTC_VIDEO_CODEC_OK); |  946                         init_retval == WEBRTC_VIDEO_CODEC_OK); | 
|  940   if (init_retval == WEBRTC_VIDEO_CODEC_OK) { |  947   if (init_retval == WEBRTC_VIDEO_CODEC_OK) { | 
|  941     UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", |  948     UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", | 
|  942                               profile, |  949                               profile, | 
|  943                               media::VIDEO_CODEC_PROFILE_MAX + 1); |  950                               media::VIDEO_CODEC_PROFILE_MAX + 1); | 
|  944   } |  951   } | 
|  945 } |  952 } | 
|  946  |  953  | 
|  947 }  // namespace content |  954 }  // namespace content | 
| OLD | NEW |