OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 return false; | 69 return false; |
70 } | 70 } |
71 // Replay callback, rates, and channel parameters. | 71 // Replay callback, rates, and channel parameters. |
72 if (callback_) | 72 if (callback_) |
73 fallback_encoder_->RegisterEncodeCompleteCallback(callback_); | 73 fallback_encoder_->RegisterEncodeCompleteCallback(callback_); |
74 if (rates_set_) | 74 if (rates_set_) |
75 fallback_encoder_->SetRates(bitrate_, framerate_); | 75 fallback_encoder_->SetRates(bitrate_, framerate_); |
76 if (channel_parameters_set_) | 76 if (channel_parameters_set_) |
77 fallback_encoder_->SetChannelParameters(packet_loss_, rtt_); | 77 fallback_encoder_->SetChannelParameters(packet_loss_, rtt_); |
78 | 78 |
| 79 fallback_implementation_name_ = |
| 80 std::string(fallback_encoder_->ImplementationName()) + |
| 81 " (fallback from: " + encoder_->ImplementationName() + ")"; |
79 // Since we're switching to the fallback encoder, Release the real encoder. It | 82 // Since we're switching to the fallback encoder, Release the real encoder. It |
80 // may be re-initialized via InitEncode later, and it will continue to get | 83 // may be re-initialized via InitEncode later, and it will continue to get |
81 // Set calls for rates and channel parameters in the meantime. | 84 // Set calls for rates and channel parameters in the meantime. |
82 encoder_->Release(); | 85 encoder_->Release(); |
83 return true; | 86 return true; |
84 } | 87 } |
85 | 88 |
86 int32_t VideoEncoderSoftwareFallbackWrapper::InitEncode( | 89 int32_t VideoEncoderSoftwareFallbackWrapper::InitEncode( |
87 const VideoCodec* codec_settings, | 90 const VideoCodec* codec_settings, |
88 int32_t number_of_cores, | 91 int32_t number_of_cores, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 return fallback_encoder_->OnDroppedFrame(); | 178 return fallback_encoder_->OnDroppedFrame(); |
176 return encoder_->OnDroppedFrame(); | 179 return encoder_->OnDroppedFrame(); |
177 } | 180 } |
178 | 181 |
179 bool VideoEncoderSoftwareFallbackWrapper::SupportsNativeHandle() const { | 182 bool VideoEncoderSoftwareFallbackWrapper::SupportsNativeHandle() const { |
180 if (fallback_encoder_) | 183 if (fallback_encoder_) |
181 return fallback_encoder_->SupportsNativeHandle(); | 184 return fallback_encoder_->SupportsNativeHandle(); |
182 return encoder_->SupportsNativeHandle(); | 185 return encoder_->SupportsNativeHandle(); |
183 } | 186 } |
184 | 187 |
| 188 const char* VideoEncoderSoftwareFallbackWrapper::ImplementationName() const { |
| 189 if (fallback_encoder_) |
| 190 return fallback_implementation_name_.c_str(); |
| 191 return encoder_->ImplementationName(); |
| 192 } |
| 193 |
185 int VideoEncoderSoftwareFallbackWrapper::GetTargetFramerate() { | 194 int VideoEncoderSoftwareFallbackWrapper::GetTargetFramerate() { |
186 if (fallback_encoder_) | 195 if (fallback_encoder_) |
187 return fallback_encoder_->GetTargetFramerate(); | 196 return fallback_encoder_->GetTargetFramerate(); |
188 return encoder_->GetTargetFramerate(); | 197 return encoder_->GetTargetFramerate(); |
189 } | 198 } |
190 | 199 |
191 } // namespace webrtc | 200 } // namespace webrtc |
OLD | NEW |