| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const struct { | 107 const struct { |
| 108 const media::VideoCodec codec; | 108 const media::VideoCodec codec; |
| 109 const media::VideoCodecProfile profile; | 109 const media::VideoCodecProfile profile; |
| 110 } kSupportedCodecs[] = { | 110 } kSupportedCodecs[] = { |
| 111 { media::kCodecVP8, media::VP8PROFILE_ANY }, | 111 { media::kCodecVP8, media::VP8PROFILE_ANY }, |
| 112 { media::kCodecH264, media::H264PROFILE_BASELINE }, | 112 { media::kCodecH264, media::H264PROFILE_BASELINE }, |
| 113 { media::kCodecH264, media::H264PROFILE_MAIN } | 113 { media::kCodecH264, media::H264PROFILE_MAIN } |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 for (const auto& supported_codec : kSupportedCodecs) { | 116 for (const auto& supported_codec : kSupportedCodecs) { |
| 117 if (supported_codec.codec == media::kCodecVP8 && |
| 118 !media::MediaCodecUtil::IsVp8EncoderAvailable()) { |
| 119 continue; |
| 120 } |
| 121 |
| 117 if (VideoCodecBridge::IsKnownUnaccelerated(supported_codec.codec, | 122 if (VideoCodecBridge::IsKnownUnaccelerated(supported_codec.codec, |
| 118 media::MEDIA_CODEC_ENCODER)) { | 123 media::MEDIA_CODEC_ENCODER)) { |
| 119 continue; | 124 continue; |
| 120 } | 125 } |
| 121 | 126 |
| 122 SupportedProfile profile; | 127 SupportedProfile profile; |
| 123 profile.profile = supported_codec.profile; | 128 profile.profile = supported_codec.profile; |
| 124 // It would be nice if MediaCodec exposes the maximum capabilities of | 129 // It would be nice if MediaCodec exposes the maximum capabilities of |
| 125 // the encoder. Hard-code some reasonable defaults as workaround. | 130 // the encoder. Hard-code some reasonable defaults as workaround. |
| 126 profile.max_resolution.SetSize(kMaxEncodeFrameWidth, | 131 profile.max_resolution.SetSize(kMaxEncodeFrameWidth, |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 base::MessageLoop::current()->PostTask( | 437 base::MessageLoop::current()->PostTask( |
| 433 FROM_HERE, | 438 FROM_HERE, |
| 434 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, | 439 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, |
| 435 client_ptr_factory_->GetWeakPtr(), | 440 client_ptr_factory_->GetWeakPtr(), |
| 436 bitstream_buffer.id(), | 441 bitstream_buffer.id(), |
| 437 size, | 442 size, |
| 438 key_frame)); | 443 key_frame)); |
| 439 } | 444 } |
| 440 | 445 |
| 441 } // namespace content | 446 } // namespace content |
| OLD | NEW |