| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/renderer/media_recorder/video_track_recorder.h" | 5 #include "content/renderer/media_recorder/video_track_recorder.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 using CodecId = VideoTrackRecorder::CodecId; | 44 using CodecId = VideoTrackRecorder::CodecId; |
| 45 | 45 |
| 46 static const struct { | 46 static const struct { |
| 47 CodecId codec_id; | 47 CodecId codec_id; |
| 48 media::VideoCodecProfile min_profile; | 48 media::VideoCodecProfile min_profile; |
| 49 media::VideoCodecProfile max_profile; | 49 media::VideoCodecProfile max_profile; |
| 50 } kPreferredCodecIdAndVEAProfiles[] = { | 50 } kPreferredCodecIdAndVEAProfiles[] = { |
| 51 {CodecId::VP8, media::VP8PROFILE_MIN, media::VP8PROFILE_MAX}, | 51 {CodecId::VP8, media::VP8PROFILE_MIN, media::VP8PROFILE_MAX}, |
| 52 {CodecId::VP9, media::VP9PROFILE_MIN, media::VP9PROFILE_MAX}, | 52 {CodecId::VP9, media::VP9PROFILE_MIN, media::VP9PROFILE_MAX}, |
| 53 #if BUILDFLAG(RTC_USE_H264) | 53 #if BUILDFLAG(RTC_USE_H264) || defined(OS_ANDROID) |
| 54 {CodecId::H264, media::H264PROFILE_MIN, media::H264PROFILE_MAX} | 54 {CodecId::H264, media::H264PROFILE_MIN, media::H264PROFILE_MAX} |
| 55 #endif | 55 #endif |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 static_assert(arraysize(kPreferredCodecIdAndVEAProfiles) == | 58 static_assert(arraysize(kPreferredCodecIdAndVEAProfiles) == |
| 59 static_cast<int>(CodecId::LAST), | 59 static_cast<int>(CodecId::LAST), |
| 60 "|kPreferredCodecIdAndVEAProfiles| should consider all CodecIds"); | 60 "|kPreferredCodecIdAndVEAProfiles| should consider all CodecIds"); |
| 61 | 61 |
| 62 // Class to encapsulate the enumeration of CodecIds/VideoCodecProfiles supported | 62 // Class to encapsulate the enumeration of CodecIds/VideoCodecProfiles supported |
| 63 // by the VEA underlying platform. Provides methods to query the preferred | 63 // by the VEA underlying platform. Provides methods to query the preferred |
| (...skipping 22 matching lines...) Expand all Loading... |
| 86 static CodecEnumerator* enumerator = new CodecEnumerator(); | 86 static CodecEnumerator* enumerator = new CodecEnumerator(); |
| 87 return enumerator; | 87 return enumerator; |
| 88 } | 88 } |
| 89 | 89 |
| 90 CodecEnumerator::CodecEnumerator() { | 90 CodecEnumerator::CodecEnumerator() { |
| 91 #if defined(OS_CHROMEOS) | 91 #if defined(OS_CHROMEOS) |
| 92 // See https://crbug.com/616659. | 92 // See https://crbug.com/616659. |
| 93 return; | 93 return; |
| 94 #endif | 94 #endif |
| 95 | 95 |
| 96 #if defined(OS_ANDROID) | |
| 97 // See https://crbug.com/653864. | |
| 98 return; | |
| 99 #endif | |
| 100 | |
| 101 content::RenderThreadImpl* const render_thread_impl = | 96 content::RenderThreadImpl* const render_thread_impl = |
| 102 content::RenderThreadImpl::current(); | 97 content::RenderThreadImpl::current(); |
| 103 if (!render_thread_impl) { | 98 if (!render_thread_impl) { |
| 104 DVLOG(2) << "Couldn't access the render thread"; | 99 DVLOG(2) << "Couldn't access the render thread"; |
| 105 return; | 100 return; |
| 106 } | 101 } |
| 107 | 102 |
| 108 media::GpuVideoAcceleratorFactories* const gpu_factories = | 103 media::GpuVideoAcceleratorFactories* const gpu_factories = |
| 109 render_thread_impl->GetGpuFactories(); | 104 render_thread_impl->GetGpuFactories(); |
| 110 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { | 105 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 MediaStreamVideoSink::DisconnectFromTrack(); | 430 MediaStreamVideoSink::DisconnectFromTrack(); |
| 436 encoder_ = nullptr; | 431 encoder_ = nullptr; |
| 437 MediaStreamVideoSink::ConnectToTrack( | 432 MediaStreamVideoSink::ConnectToTrack( |
| 438 track_, | 433 track_, |
| 439 media::BindToCurrentLoop(base::Bind(initialize_encoder_callback_, | 434 media::BindToCurrentLoop(base::Bind(initialize_encoder_callback_, |
| 440 false /*allow_vea_encoder*/)), | 435 false /*allow_vea_encoder*/)), |
| 441 false); | 436 false); |
| 442 } | 437 } |
| 443 | 438 |
| 444 } // namespace content | 439 } // namespace content |
| OLD | NEW |