| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/cast/video_sender/external_video_encoder.h" | 5 #include "media/cast/video_sender/external_video_encoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 index)); | 149 index)); |
| 150 | 150 |
| 151 if (!frame) { | 151 if (!frame) { |
| 152 VLOG(1) << "EncodeVideoFrame(): failed to create frame"; | 152 VLOG(1) << "EncodeVideoFrame(): failed to create frame"; |
| 153 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); | 153 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| 156 // Do a stride copy of the input frame to match the input requirements. | 156 // Do a stride copy of the input frame to match the input requirements. |
| 157 media::CopyYPlane(video_frame->data(VideoFrame::kYPlane), | 157 media::CopyYPlane(video_frame->data(VideoFrame::kYPlane), |
| 158 video_frame->stride(VideoFrame::kYPlane), | 158 video_frame->stride(VideoFrame::kYPlane), |
| 159 video_frame->natural_size().height(), | 159 video_frame->coded_size().height(), |
| 160 frame.get()); | 160 frame.get()); |
| 161 media::CopyUPlane(video_frame->data(VideoFrame::kUPlane), | 161 media::CopyUPlane(video_frame->data(VideoFrame::kUPlane), |
| 162 video_frame->stride(VideoFrame::kUPlane), | 162 video_frame->stride(VideoFrame::kUPlane), |
| 163 video_frame->natural_size().height(), | 163 video_frame->coded_size().height(), |
| 164 frame.get()); | 164 frame.get()); |
| 165 media::CopyVPlane(video_frame->data(VideoFrame::kVPlane), | 165 media::CopyVPlane(video_frame->data(VideoFrame::kVPlane), |
| 166 video_frame->stride(VideoFrame::kVPlane), | 166 video_frame->stride(VideoFrame::kVPlane), |
| 167 video_frame->natural_size().height(), | 167 video_frame->coded_size().height(), |
| 168 frame.get()); | 168 frame.get()); |
| 169 | 169 |
| 170 encoded_frame_data_storage_.push_back( | 170 encoded_frame_data_storage_.push_back( |
| 171 EncodedFrameReturnData(capture_time, frame_encoded_callback)); | 171 EncodedFrameReturnData(capture_time, frame_encoded_callback)); |
| 172 | 172 |
| 173 // BitstreamBufferReady will be called once the encoder is done. | 173 // BitstreamBufferReady will be called once the encoder is done. |
| 174 video_encode_accelerator_->Encode(frame, key_frame_requested); | 174 video_encode_accelerator_->Encode(frame, key_frame_requested); |
| 175 } | 175 } |
| 176 | 176 |
| 177 protected: | 177 protected: |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 // Do nothing not supported. | 448 // Do nothing not supported. |
| 449 } | 449 } |
| 450 | 450 |
| 451 int ExternalVideoEncoder::NumberOfSkippedFrames() const { | 451 int ExternalVideoEncoder::NumberOfSkippedFrames() const { |
| 452 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 452 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 453 return skip_count_; | 453 return skip_count_; |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace cast | 456 } // namespace cast |
| 457 } // namespace media | 457 } // namespace media |
| OLD | NEW |