| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 DVLOG(2) << "Couldn't initialize GpuVideoAcceleratorFactories"; | 122 DVLOG(2) << "Couldn't initialize GpuVideoAcceleratorFactories"; |
| 123 return; | 123 return; |
| 124 } | 124 } |
| 125 | 125 |
| 126 const auto vea_supported_profiles = | 126 const auto vea_supported_profiles = |
| 127 gpu_factories->GetVideoEncodeAcceleratorSupportedProfiles(); | 127 gpu_factories->GetVideoEncodeAcceleratorSupportedProfiles(); |
| 128 for (const auto& supported_profile : vea_supported_profiles) { | 128 for (const auto& supported_profile : vea_supported_profiles) { |
| 129 const media::VideoCodecProfile codec = supported_profile.profile; | 129 const media::VideoCodecProfile codec = supported_profile.profile; |
| 130 #if defined(OS_ANDROID) | 130 #if defined(OS_ANDROID) |
| 131 // TODO(mcasas): enable other codecs, https://crbug.com/638664. | 131 // TODO(mcasas): enable other codecs, https://crbug.com/638664. |
| 132 if (codec < media::VP8PROFILE_MIN || codec > media::VP8PROFILE_MAX) | 132 static_assert(media::VP8PROFILE_MAX + 1 == media::VP9PROFILE_MIN, |
| 133 "VP8 and VP9 VideoCodecProfiles should be contiguous"); |
| 134 if (codec < media::VP8PROFILE_MIN || codec > media::VP9PROFILE_MAX) |
| 133 continue; | 135 continue; |
| 134 #endif | 136 #endif |
| 135 for (auto& codec_id_and_profile : kPreferredCodecIdAndVEAProfiles) { | 137 for (auto& codec_id_and_profile : kPreferredCodecIdAndVEAProfiles) { |
| 136 if (codec >= codec_id_and_profile.min_profile && | 138 if (codec >= codec_id_and_profile.min_profile && |
| 137 codec <= codec_id_and_profile.max_profile) { | 139 codec <= codec_id_and_profile.max_profile) { |
| 138 DVLOG(2) << "Accelerated codec found: " << media::GetProfileName(codec); | 140 DVLOG(2) << "Accelerated codec found: " << media::GetProfileName(codec); |
| 139 codec_id_to_profile_.insert( | 141 codec_id_to_profile_.insert( |
| 140 std::make_pair(codec_id_and_profile.codec_id, codec)); | 142 std::make_pair(codec_id_and_profile.codec_id, codec)); |
| 141 } | 143 } |
| 142 } | 144 } |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 MediaStreamVideoSink::DisconnectFromTrack(); | 460 MediaStreamVideoSink::DisconnectFromTrack(); |
| 459 encoder_ = nullptr; | 461 encoder_ = nullptr; |
| 460 MediaStreamVideoSink::ConnectToTrack( | 462 MediaStreamVideoSink::ConnectToTrack( |
| 461 track_, | 463 track_, |
| 462 media::BindToCurrentLoop(base::Bind(initialize_encoder_callback_, | 464 media::BindToCurrentLoop(base::Bind(initialize_encoder_callback_, |
| 463 false /*allow_vea_encoder*/)), | 465 false /*allow_vea_encoder*/)), |
| 464 false); | 466 false); |
| 465 } | 467 } |
| 466 | 468 |
| 467 } // namespace content | 469 } // namespace content |
| OLD | NEW |