| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 using CodecId = VideoTrackRecorder::CodecId; | 60 using CodecId = VideoTrackRecorder::CodecId; |
| 61 | 61 |
| 62 static const struct { | 62 static const struct { |
| 63 CodecId codec_id; | 63 CodecId codec_id; |
| 64 media::VideoCodecProfile min_profile; | 64 media::VideoCodecProfile min_profile; |
| 65 media::VideoCodecProfile max_profile; | 65 media::VideoCodecProfile max_profile; |
| 66 } kPreferredCodecIdAndVEAProfiles[] = { | 66 } kPreferredCodecIdAndVEAProfiles[] = { |
| 67 {CodecId::VP8, media::VP8PROFILE_MIN, media::VP8PROFILE_MAX}, | 67 {CodecId::VP8, media::VP8PROFILE_MIN, media::VP8PROFILE_MAX}, |
| 68 {CodecId::VP9, media::VP9PROFILE_MIN, media::VP9PROFILE_MAX}, | 68 {CodecId::VP9, media::VP9PROFILE_MIN, media::VP9PROFILE_MAX}, |
| 69 #if defined(IS_H264_SUPPORTED) | 69 #if BUILDFLAG(RTC_USE_H264) |
| 70 {CodecId::H264, media::H264PROFILE_MIN, media::H264PROFILE_MAX} | 70 {CodecId::H264, media::H264PROFILE_MIN, media::H264PROFILE_MAX} |
| 71 #endif | 71 #endif |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 static_assert(arraysize(kPreferredCodecIdAndVEAProfiles) == | 74 static_assert(arraysize(kPreferredCodecIdAndVEAProfiles) == |
| 75 static_cast<int>(CodecId::LAST), | 75 static_cast<int>(CodecId::LAST), |
| 76 "|kPreferredCodecIdAndVEAProfiles| should consider all CodecIds"); | 76 "|kPreferredCodecIdAndVEAProfiles| should consider all CodecIds"); |
| 77 | 77 |
| 78 // Class to encapsulate the enumeration of CodecIds/VideoCodecProfiles supported | 78 // Class to encapsulate the enumeration of CodecIds/VideoCodecProfiles supported |
| 79 // by the VEA underlying platform. Provides methods to query the preferred | 79 // by the VEA underlying platform. Provides methods to query the preferred |
| (...skipping 22 matching lines...) Expand all Loading... |
| 102 static CodecEnumerator* enumerator = new CodecEnumerator(); | 102 static CodecEnumerator* enumerator = new CodecEnumerator(); |
| 103 return enumerator; | 103 return enumerator; |
| 104 } | 104 } |
| 105 | 105 |
| 106 CodecEnumerator::CodecEnumerator() { | 106 CodecEnumerator::CodecEnumerator() { |
| 107 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
| 108 // See https://crbug.com/616659. | 108 // See https://crbug.com/616659. |
| 109 return; | 109 return; |
| 110 #endif | 110 #endif |
| 111 | 111 |
| 112 #if defined(OS_ANDROID) |
| 113 // See https://crbug.com/653864. |
| 114 return; |
| 115 #endif |
| 116 |
| 112 content::RenderThreadImpl* const render_thread_impl = | 117 content::RenderThreadImpl* const render_thread_impl = |
| 113 content::RenderThreadImpl::current(); | 118 content::RenderThreadImpl::current(); |
| 114 if (!render_thread_impl) { | 119 if (!render_thread_impl) { |
| 115 DVLOG(2) << "Couldn't access the render thread"; | 120 DVLOG(2) << "Couldn't access the render thread"; |
| 116 return; | 121 return; |
| 117 } | 122 } |
| 118 | 123 |
| 119 media::GpuVideoAcceleratorFactories* const gpu_factories = | 124 media::GpuVideoAcceleratorFactories* const gpu_factories = |
| 120 render_thread_impl->GetGpuFactories(); | 125 render_thread_impl->GetGpuFactories(); |
| 121 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { | 126 if (!gpu_factories || !gpu_factories->IsGpuVideoAcceleratorEnabled()) { |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 MediaStreamVideoSink::DisconnectFromTrack(); | 458 MediaStreamVideoSink::DisconnectFromTrack(); |
| 454 encoder_ = nullptr; | 459 encoder_ = nullptr; |
| 455 MediaStreamVideoSink::ConnectToTrack( | 460 MediaStreamVideoSink::ConnectToTrack( |
| 456 track_, | 461 track_, |
| 457 media::BindToCurrentLoop(base::Bind(initialize_encoder_callback_, | 462 media::BindToCurrentLoop(base::Bind(initialize_encoder_callback_, |
| 458 false /*allow_vea_encoder*/)), | 463 false /*allow_vea_encoder*/)), |
| 459 false); | 464 false); |
| 460 } | 465 } |
| 461 | 466 |
| 462 } // namespace content | 467 } // namespace content |
| OLD | NEW |