| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 SignalAsyncWaiter(WEBRTC_VIDEO_CODEC_ERROR); | 558 SignalAsyncWaiter(WEBRTC_VIDEO_CODEC_ERROR); |
| 559 return; | 559 return; |
| 560 } | 560 } |
| 561 | 561 |
| 562 const int index = input_buffers_free_.back(); | 562 const int index = input_buffers_free_.back(); |
| 563 bool requires_copy = false; | 563 bool requires_copy = false; |
| 564 scoped_refptr<media::VideoFrame> frame; | 564 scoped_refptr<media::VideoFrame> frame; |
| 565 if (next_frame->video_frame_buffer()->native_handle()) { | 565 if (next_frame->video_frame_buffer()->native_handle()) { |
| 566 frame = static_cast<media::VideoFrame*>( | 566 frame = static_cast<media::VideoFrame*>( |
| 567 next_frame->video_frame_buffer()->native_handle()); | 567 next_frame->video_frame_buffer()->native_handle()); |
| 568 requires_copy = RequiresSizeChange(frame); | 568 requires_copy = RequiresSizeChange(frame) || |
| 569 frame->storage_type() != media::VideoFrame::STORAGE_SHMEM; |
| 569 } else { | 570 } else { |
| 570 requires_copy = true; | 571 requires_copy = true; |
| 571 } | 572 } |
| 572 | 573 |
| 573 if (requires_copy) { | 574 if (requires_copy) { |
| 574 const base::TimeDelta timestamp = | 575 const base::TimeDelta timestamp = |
| 575 frame ? frame->timestamp() | 576 frame ? frame->timestamp() |
| 576 : base::TimeDelta::FromMilliseconds(next_frame->ntp_time_ms()); | 577 : base::TimeDelta::FromMilliseconds(next_frame->ntp_time_ms()); |
| 577 base::SharedMemory* input_buffer = input_buffers_[index]; | 578 base::SharedMemory* input_buffer = input_buffers_[index]; |
| 578 frame = media::VideoFrame::WrapExternalSharedMemory( | 579 frame = media::VideoFrame::WrapExternalSharedMemory( |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", | 881 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess", |
| 881 init_retval == WEBRTC_VIDEO_CODEC_OK); | 882 init_retval == WEBRTC_VIDEO_CODEC_OK); |
| 882 if (init_retval == WEBRTC_VIDEO_CODEC_OK) { | 883 if (init_retval == WEBRTC_VIDEO_CODEC_OK) { |
| 883 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", | 884 UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile", |
| 884 profile, | 885 profile, |
| 885 media::VIDEO_CODEC_PROFILE_MAX + 1); | 886 media::VIDEO_CODEC_PROFILE_MAX + 1); |
| 886 } | 887 } |
| 887 } | 888 } |
| 888 | 889 |
| 889 } // namespace content | 890 } // namespace content |
| OLD | NEW |