Chromium Code Reviews| Index: webrtc/modules/audio_coding/codecs/opus/opus_interface.c |
| diff --git a/webrtc/modules/audio_coding/codecs/opus/opus_interface.c b/webrtc/modules/audio_coding/codecs/opus/opus_interface.c |
| index 4f6e22f77d021a7161f2977f8404c34af43208a3..6d6540e82437848d4a32aff1267ddad7e4128ece 100644 |
| --- a/webrtc/modules/audio_coding/codecs/opus/opus_interface.c |
| +++ b/webrtc/modules/audio_coding/codecs/opus/opus_interface.c |
| @@ -359,6 +359,12 @@ int WebRtcOpus_DecodeFec(OpusDecInst* inst, const uint8_t* encoded, |
| int WebRtcOpus_DurationEst(OpusDecInst* inst, |
| const uint8_t* payload, |
| size_t payload_length_bytes) { |
| + if (payload_length_bytes == 0) { |
| + // WebRtcOpus_Decode calls PLC when payload length is zero. So we returns |
|
hlundin-webrtc
2015/09/15 13:05:09
we returns -> we return
|
| + // PLC duration correspondingly. |
| + return WebRtcOpus_PlcDuration(inst); |
| + } |
| + |
| int frames, samples; |
| frames = opus_packet_get_nb_frames(payload, (opus_int32)payload_length_bytes); |
| if (frames < 0) { |
| @@ -373,6 +379,18 @@ int WebRtcOpus_DurationEst(OpusDecInst* inst, |
| return samples; |
| } |
| +int WebRtcOpus_PlcDuration(OpusDecInst* inst) { |
| + /* The number of samples we ask for is |number_of_lost_frames| times |
| + * |prev_decoded_samples_|. Limit the number of samples to maximum |
| + * |kWebRtcOpusMaxFrameSizePerChannel|. */ |
| + int plc_samples; |
|
hlundin-webrtc
2015/09/15 13:05:09
Merge lines 386 and 387, and make it const.
minyue-webrtc
2015/09/16 08:05:31
Done.
|
| + plc_samples = inst->prev_decoded_samples; |
| + plc_samples = (plc_samples <= kWebRtcOpusMaxFrameSizePerChannel) ? |
| + plc_samples : kWebRtcOpusMaxFrameSizePerChannel; |
| + return plc_samples; |
|
hlundin-webrtc
2015/09/15 13:05:09
return (plc_samples <= kWebRtcOpusMaxFrameSizePerC
minyue-webrtc
2015/09/16 08:05:31
Done.
|
| +} |
| + |
| + |
|
hlundin-webrtc
2015/09/15 13:05:09
Remove one extra line.
minyue-webrtc
2015/09/16 08:05:31
Done.
|
| int WebRtcOpus_FecDurationEst(const uint8_t* payload, |
| size_t payload_length_bytes) { |
| int samples; |