| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 AndroidVideoEncodeAccelerator::AndroidVideoEncodeAccelerator() | 70 AndroidVideoEncodeAccelerator::AndroidVideoEncodeAccelerator() |
| 71 : num_buffers_at_codec_(0), | 71 : num_buffers_at_codec_(0), |
| 72 num_output_buffers_(-1), | 72 num_output_buffers_(-1), |
| 73 output_buffers_capacity_(0), | 73 output_buffers_capacity_(0), |
| 74 last_set_bitrate_(0) {} | 74 last_set_bitrate_(0) {} |
| 75 | 75 |
| 76 AndroidVideoEncodeAccelerator::~AndroidVideoEncodeAccelerator() { | 76 AndroidVideoEncodeAccelerator::~AndroidVideoEncodeAccelerator() { |
| 77 DCHECK(thread_checker_.CalledOnValidThread()); | 77 DCHECK(thread_checker_.CalledOnValidThread()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 80 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> |
| 81 AndroidVideoEncodeAccelerator::GetSupportedProfiles() { | 81 AndroidVideoEncodeAccelerator::GetSupportedProfiles() { |
| 82 std::vector<MediaCodecBridge::CodecsInfo> codecs_info = | 82 std::vector<MediaCodecBridge::CodecsInfo> codecs_info = |
| 83 MediaCodecBridge::GetCodecsInfo(); | 83 MediaCodecBridge::GetCodecsInfo(); |
| 84 | 84 |
| 85 std::vector<SupportedProfile> profiles; | 85 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> profiles; |
| 86 | 86 |
| 87 #if defined(ENABLE_WEBRTC) | 87 #if defined(ENABLE_WEBRTC) |
| 88 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 88 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 89 if (cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) | 89 if (cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) |
| 90 return profiles; | 90 return profiles; |
| 91 #endif | 91 #endif |
| 92 | 92 |
| 93 for (size_t i = 0; i < codecs_info.size(); ++i) { | 93 for (size_t i = 0; i < codecs_info.size(); ++i) { |
| 94 const MediaCodecBridge::CodecsInfo& info = codecs_info[i]; | 94 const MediaCodecBridge::CodecsInfo& info = codecs_info[i]; |
| 95 if (info.direction != media::MEDIA_CODEC_ENCODER || info.codecs != "vp8" || | 95 if (info.direction != media::MEDIA_CODEC_ENCODER || info.codecs != "vp8" || |
| 96 VideoCodecBridge::IsKnownUnaccelerated(media::kCodecVP8, | 96 VideoCodecBridge::IsKnownUnaccelerated(media::kCodecVP8, |
| 97 media::MEDIA_CODEC_ENCODER)) { | 97 media::MEDIA_CODEC_ENCODER)) { |
| 98 // We're only looking for a HW VP8 encoder. | 98 // We're only looking for a HW VP8 encoder. |
| 99 continue; | 99 continue; |
| 100 } | 100 } |
| 101 SupportedProfile profile; | 101 gpu::VideoEncodeAcceleratorSupportedProfile profile; |
| 102 profile.profile = media::VP8PROFILE_ANY; | 102 profile.profile = media::VP8PROFILE_ANY; |
| 103 // Wouldn't it be nice if MediaCodec exposed the maximum capabilities of the | 103 // Wouldn't it be nice if MediaCodec exposed the maximum capabilities of the |
| 104 // encoder? Sure would be. Too bad it doesn't. So we hard-code some | 104 // encoder? Sure would be. Too bad it doesn't. So we hard-code some |
| 105 // reasonable defaults. | 105 // reasonable defaults. |
| 106 profile.max_resolution.SetSize(1920, 1088); | 106 profile.max_resolution.SetSize(1920, 1088); |
| 107 profile.max_framerate_numerator = 30; | 107 profile.max_framerate_numerator = 30; |
| 108 profile.max_framerate_denominator = 1; | 108 profile.max_framerate_denominator = 1; |
| 109 profiles.push_back(profile); | 109 profiles.push_back(profile); |
| 110 } | 110 } |
| 111 return profiles; | 111 return profiles; |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 base::MessageLoop::current()->PostTask( | 403 base::MessageLoop::current()->PostTask( |
| 404 FROM_HERE, | 404 FROM_HERE, |
| 405 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, | 405 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, |
| 406 client_ptr_factory_->GetWeakPtr(), | 406 client_ptr_factory_->GetWeakPtr(), |
| 407 bitstream_buffer.id(), | 407 bitstream_buffer.id(), |
| 408 size, | 408 size, |
| 409 key_frame)); | 409 key_frame)); |
| 410 } | 410 } |
| 411 | 411 |
| 412 } // namespace content | 412 } // namespace content |
| OLD | NEW |