| 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); | |
| 627 const base::TimeDelta timestamp = | 621 const base::TimeDelta timestamp = |
| 628 use_media_timestamp | 622 frame ? frame->timestamp() |
| 629 ? frame->timestamp() | 623 : base::TimeDelta::FromMilliseconds(next_frame->ntp_time_ms()); |
| 630 : base::TimeDelta::FromMilliseconds(next_frame->ntp_time_ms()); | |
| 631 base::SharedMemory* input_buffer = input_buffers_[index].get(); | 624 base::SharedMemory* input_buffer = input_buffers_[index].get(); |
| 632 frame = media::VideoFrame::WrapExternalSharedMemory( | 625 frame = media::VideoFrame::WrapExternalSharedMemory( |
| 633 media::PIXEL_FORMAT_I420, input_frame_coded_size_, | 626 media::PIXEL_FORMAT_I420, input_frame_coded_size_, |
| 634 gfx::Rect(input_visible_size_), input_visible_size_, | 627 gfx::Rect(input_visible_size_), input_visible_size_, |
| 635 reinterpret_cast<uint8_t*>(input_buffer->memory()), | 628 reinterpret_cast<uint8_t*>(input_buffer->memory()), |
| 636 input_buffer->mapped_size(), input_buffer->handle(), 0, timestamp); | 629 input_buffer->mapped_size(), input_buffer->handle(), 0, timestamp); |
| 637 if (!frame.get()) { | 630 if (!frame.get()) { |
| 638 LogAndNotifyError(FROM_HERE, "failed to create frame", | 631 LogAndNotifyError(FROM_HERE, "failed to create frame", |
| 639 media::VideoEncodeAccelerator::kPlatformFailureError); | 632 media::VideoEncodeAccelerator::kPlatformFailureError); |
| 640 return; | 633 return; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", | 938 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", |
| 946 init_retval == WEBRTC_VIDEO_CODEC_OK); | 939 init_retval == WEBRTC_VIDEO_CODEC_OK); |
| 947 if (init_retval == WEBRTC_VIDEO_CODEC_OK) { | 940 if (init_retval == WEBRTC_VIDEO_CODEC_OK) { |
| 948 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", | 941 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", |
| 949 profile, | 942 profile, |
| 950 media::VIDEO_CODEC_PROFILE_MAX + 1); | 943 media::VIDEO_CODEC_PROFILE_MAX + 1); |
| 951 } | 944 } |
| 952 } | 945 } |
| 953 | 946 |
| 954 } // namespace content | 947 } // namespace content |
| OLD | NEW |