| 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/common/gpu/media/android_video_encode_accelerator.h" | 5 #include "content/common/gpu/media/android_video_encode_accelerator.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const struct { | 114 const struct { |
| 115 const media::VideoCodec codec; | 115 const media::VideoCodec codec; |
| 116 const media::VideoCodecProfile profile; | 116 const media::VideoCodecProfile profile; |
| 117 } kSupportedCodecs[] = { | 117 } kSupportedCodecs[] = { |
| 118 { media::kCodecVP8, media::VP8PROFILE_ANY }, | 118 { media::kCodecVP8, media::VP8PROFILE_ANY }, |
| 119 { media::kCodecH264, media::H264PROFILE_BASELINE }, | 119 { media::kCodecH264, media::H264PROFILE_BASELINE }, |
| 120 { media::kCodecH264, media::H264PROFILE_MAIN } | 120 { media::kCodecH264, media::H264PROFILE_MAIN } |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 for (const auto& supported_codec : kSupportedCodecs) { | 123 for (const auto& supported_codec : kSupportedCodecs) { |
| 124 if (supported_codec.codec == media::kCodecVP8 && |
| 125 !media::MediaCodecUtil::IsVp8EncoderAvailable()) { |
| 126 continue; |
| 127 } |
| 128 |
| 124 if (VideoCodecBridge::IsKnownUnaccelerated(supported_codec.codec, | 129 if (VideoCodecBridge::IsKnownUnaccelerated(supported_codec.codec, |
| 125 media::MEDIA_CODEC_ENCODER)) { | 130 media::MEDIA_CODEC_ENCODER)) { |
| 126 continue; | 131 continue; |
| 127 } | 132 } |
| 128 | 133 |
| 129 SupportedProfile profile; | 134 SupportedProfile profile; |
| 130 profile.profile = supported_codec.profile; | 135 profile.profile = supported_codec.profile; |
| 131 // It would be nice if MediaCodec exposes the maximum capabilities of | 136 // It would be nice if MediaCodec exposes the maximum capabilities of |
| 132 // the encoder. Hard-code some reasonable defaults as workaround. | 137 // the encoder. Hard-code some reasonable defaults as workaround. |
| 133 profile.max_resolution.SetSize(kMaxEncodeFrameWidth, | 138 profile.max_resolution.SetSize(kMaxEncodeFrameWidth, |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 base::MessageLoop::current()->PostTask( | 447 base::MessageLoop::current()->PostTask( |
| 443 FROM_HERE, | 448 FROM_HERE, |
| 444 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, | 449 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, |
| 445 client_ptr_factory_->GetWeakPtr(), | 450 client_ptr_factory_->GetWeakPtr(), |
| 446 bitstream_buffer.id(), | 451 bitstream_buffer.id(), |
| 447 size, | 452 size, |
| 448 key_frame)); | 453 key_frame)); |
| 449 } | 454 } |
| 450 | 455 |
| 451 } // namespace content | 456 } // namespace content |
| OLD | NEW |