| 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" | |
| 11 #include "base/logging.h" | 10 #include "base/logging.h" |
| 12 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 13 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 14 #include "content/common/gpu/gpu_channel.h" | 13 #include "content/common/gpu/gpu_channel.h" |
| 15 #include "content/common/gpu/media/shared_memory_region.h" | 14 #include "content/common/gpu/media/shared_memory_region.h" |
| 16 #include "content/public/common/content_switches.h" | |
| 17 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 15 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 18 #include "media/base/android/media_codec_util.h" | 16 #include "media/base/android/media_codec_util.h" |
| 19 #include "media/base/bitstream_buffer.h" | 17 #include "media/base/bitstream_buffer.h" |
| 20 #include "media/base/limits.h" | 18 #include "media/base/limits.h" |
| 21 #include "media/video/picture.h" | 19 #include "media/video/picture.h" |
| 22 #include "third_party/libyuv/include/libyuv/convert_from.h" | 20 #include "third_party/libyuv/include/libyuv/convert_from.h" |
| 23 #include "ui/gl/android/scoped_java_surface.h" | 21 #include "ui/gl/android/scoped_java_surface.h" |
| 24 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
| 25 | 23 |
| 26 using media::VideoCodecBridge; | 24 using media::VideoCodecBridge; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 last_set_bitrate_(0) {} | 97 last_set_bitrate_(0) {} |
| 100 | 98 |
| 101 AndroidVideoEncodeAccelerator::~AndroidVideoEncodeAccelerator() { | 99 AndroidVideoEncodeAccelerator::~AndroidVideoEncodeAccelerator() { |
| 102 DCHECK(thread_checker_.CalledOnValidThread()); | 100 DCHECK(thread_checker_.CalledOnValidThread()); |
| 103 } | 101 } |
| 104 | 102 |
| 105 media::VideoEncodeAccelerator::SupportedProfiles | 103 media::VideoEncodeAccelerator::SupportedProfiles |
| 106 AndroidVideoEncodeAccelerator::GetSupportedProfiles() { | 104 AndroidVideoEncodeAccelerator::GetSupportedProfiles() { |
| 107 SupportedProfiles profiles; | 105 SupportedProfiles profiles; |
| 108 | 106 |
| 109 #if defined(ENABLE_WEBRTC) | |
| 110 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | |
| 111 if (cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) | |
| 112 return profiles; | |
| 113 #endif | |
| 114 | |
| 115 const struct { | 107 const struct { |
| 116 const media::VideoCodec codec; | 108 const media::VideoCodec codec; |
| 117 const media::VideoCodecProfile profile; | 109 const media::VideoCodecProfile profile; |
| 118 } kSupportedCodecs[] = { | 110 } kSupportedCodecs[] = { |
| 119 { media::kCodecVP8, media::VP8PROFILE_ANY }, | 111 { media::kCodecVP8, media::VP8PROFILE_ANY }, |
| 120 { media::kCodecH264, media::H264PROFILE_BASELINE }, | 112 { media::kCodecH264, media::H264PROFILE_BASELINE }, |
| 121 { media::kCodecH264, media::H264PROFILE_MAIN } | 113 { media::kCodecH264, media::H264PROFILE_MAIN } |
| 122 }; | 114 }; |
| 123 | 115 |
| 124 for (const auto& supported_codec : kSupportedCodecs) { | 116 for (const auto& supported_codec : kSupportedCodecs) { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 base::MessageLoop::current()->PostTask( | 432 base::MessageLoop::current()->PostTask( |
| 441 FROM_HERE, | 433 FROM_HERE, |
| 442 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, | 434 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, |
| 443 client_ptr_factory_->GetWeakPtr(), | 435 client_ptr_factory_->GetWeakPtr(), |
| 444 bitstream_buffer.id(), | 436 bitstream_buffer.id(), |
| 445 size, | 437 size, |
| 446 key_frame)); | 438 key_frame)); |
| 447 } | 439 } |
| 448 | 440 |
| 449 } // namespace content | 441 } // namespace content |
| OLD | NEW |