| 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/sender/external_video_encoder.h" | 5 #include "media/cast/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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/metrics/histogram.h" |
| 12 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
| 13 #include "media/base/video_util.h" | 14 #include "media/base/video_util.h" |
| 14 #include "media/cast/cast_defines.h" | 15 #include "media/cast/cast_defines.h" |
| 15 #include "media/cast/logging/logging_defines.h" | 16 #include "media/cast/logging/logging_defines.h" |
| 16 #include "media/cast/net/cast_transport_config.h" | 17 #include "media/cast/net/cast_transport_config.h" |
| 17 #include "media/video/video_encode_accelerator.h" | 18 #include "media/video/video_encode_accelerator.h" |
| 18 | 19 |
| 19 namespace media { | 20 namespace media { |
| 20 namespace cast { | 21 namespace cast { |
| 21 class LocalVideoEncodeAcceleratorClient; | 22 class LocalVideoEncodeAcceleratorClient; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 break; | 108 break; |
| 108 case CODEC_VIDEO_FAKE: | 109 case CODEC_VIDEO_FAKE: |
| 109 NOTREACHED() << "Fake software video encoder cannot be external"; | 110 NOTREACHED() << "Fake software video encoder cannot be external"; |
| 110 break; | 111 break; |
| 111 default: | 112 default: |
| 112 NOTREACHED() << "Video codec not specified or not supported"; | 113 NOTREACHED() << "Video codec not specified or not supported"; |
| 113 break; | 114 break; |
| 114 } | 115 } |
| 115 max_frame_rate_ = video_config.max_frame_rate; | 116 max_frame_rate_ = video_config.max_frame_rate; |
| 116 | 117 |
| 117 if (!video_encode_accelerator_->Initialize( | 118 bool result = video_encode_accelerator_->Initialize( |
| 118 media::VideoFrame::I420, | 119 media::VideoFrame::I420, |
| 119 gfx::Size(video_config.width, video_config.height), | 120 gfx::Size(video_config.width, video_config.height), |
| 120 output_profile, | 121 output_profile, |
| 121 video_config.start_bitrate, | 122 video_config.start_bitrate, |
| 122 this)) { | 123 this); |
| 124 |
| 125 UMA_HISTOGRAM_BOOLEAN("Cast.Sender.VideoEncodeAcceleratorInitializeSuccess", |
| 126 result); |
| 127 if (!result) { |
| 123 NotifyError(VideoEncodeAccelerator::kInvalidArgumentError); | 128 NotifyError(VideoEncodeAccelerator::kInvalidArgumentError); |
| 124 return; | 129 return; |
| 125 } | 130 } |
| 126 | 131 |
| 127 // Wait until shared memory is allocated to indicate that encoder is | 132 // Wait until shared memory is allocated to indicate that encoder is |
| 128 // initialized. | 133 // initialized. |
| 129 } | 134 } |
| 130 | 135 |
| 131 // Free the HW. | 136 // Free the HW. |
| 132 void Destroy() { | 137 void Destroy() { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 key_frame_requested_ = true; | 430 key_frame_requested_ = true; |
| 426 } | 431 } |
| 427 | 432 |
| 428 // Inform the encoder to only reference frames older or equal to frame_id; | 433 // Inform the encoder to only reference frames older or equal to frame_id; |
| 429 void ExternalVideoEncoder::LatestFrameIdToReference(uint32 /*frame_id*/) { | 434 void ExternalVideoEncoder::LatestFrameIdToReference(uint32 /*frame_id*/) { |
| 430 // Do nothing not supported. | 435 // Do nothing not supported. |
| 431 } | 436 } |
| 432 | 437 |
| 433 } // namespace cast | 438 } // namespace cast |
| 434 } // namespace media | 439 } // namespace media |
| OLD | NEW |