Chromium Code Reviews| Index: webrtc/modules/audio_coding/test/PacketLossTest.cc |
| diff --git a/webrtc/modules/audio_coding/test/PacketLossTest.cc b/webrtc/modules/audio_coding/test/PacketLossTest.cc |
| index 68f26150bced1c12e8957744459ae9dd36bbaa67..ae489552aefdea7b213e12f381031107a5a0973c 100644 |
| --- a/webrtc/modules/audio_coding/test/PacketLossTest.cc |
| +++ b/webrtc/modules/audio_coding/test/PacketLossTest.cc |
| @@ -103,11 +103,16 @@ bool SenderWithFEC::SetFEC(bool enable_fec) { |
| } |
| bool SenderWithFEC::SetPacketLossRate(int expected_loss_rate) { |
| - if (_acm->SetPacketLossRate(expected_loss_rate) == 0) { |
| - expected_loss_rate_ = expected_loss_rate; |
| - return true; |
| - } |
| - return false; |
| + bool success = false; |
| + _acm->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
| + if (!*encoder) { |
| + // There is no existing encoder. |
| + return; |
| + } |
| + (*encoder)->SetProjectedPacketLossRate(expected_loss_rate / 100.0f); |
| + success = true; |
| + }); |
| + return success; |
|
kwiberg-webrtc
2016/10/06 09:46:13
Excellent.
minyue-webrtc
2016/10/11 17:04:34
Hi Karl,
I know that you liked this change, me to
|
| } |
| PacketLossTest::PacketLossTest(int channels, int expected_loss_rate, |