Fix problems if first packet into NetEq is rejected
This CL fixes the problem described in issue 4021. In summary, of the very first packet coming in to NetEq gets rejected because the RTP payload type is unknown, subsequent GetAudio calls would trigger asserts (in debug builds). The problem was that the first_packet_ variable was reset and new_codec_ was set, even though the packet was discarded further down the line. Now, these variables are modified after the packet has been verified. BUG=4021 R=tina.legrand@webrtc.org Review URL: https://webrtc-codereview.appspot.com/29089004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7724 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
ed91068bf1
commit
6ff3ac1db8
@ -458,8 +458,10 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
bool update_sample_rate_and_channels = false;
|
||||
// Reinitialize NetEq if it's needed (changed SSRC or first call).
|
||||
if ((main_header.ssrc != ssrc_) || first_packet_) {
|
||||
// Note: |first_packet_| will be cleared further down in this method, once
|
||||
// the packet has been successfully inserted into the packet buffer.
|
||||
|
||||
rtcp_.Init(main_header.sequenceNumber);
|
||||
first_packet_ = false;
|
||||
|
||||
// Flush the packet buffer and DTMF buffer.
|
||||
packet_buffer_->Flush();
|
||||
@ -475,13 +477,10 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
timestamp_ = main_header.timestamp;
|
||||
current_rtp_payload_type_ = main_header.payloadType;
|
||||
|
||||
// Set MCU to update codec on next SignalMCU call.
|
||||
new_codec_ = true;
|
||||
|
||||
// Reset timestamp scaling.
|
||||
timestamp_scaler_->Reset();
|
||||
|
||||
// Triger an update of sampling rate and the number of channels.
|
||||
// Trigger an update of sampling rate and the number of channels.
|
||||
update_sample_rate_and_channels = true;
|
||||
}
|
||||
|
||||
@ -612,6 +611,13 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||
PacketBuffer::DeleteAllPackets(&packet_list);
|
||||
return kOtherError;
|
||||
}
|
||||
|
||||
if (first_packet_) {
|
||||
first_packet_ = false;
|
||||
// Update the codec on the next GetAudio call.
|
||||
new_codec_ = true;
|
||||
}
|
||||
|
||||
if (current_rtp_payload_type_ != 0xFF) {
|
||||
const DecoderDatabase::DecoderInfo* dec_info =
|
||||
decoder_database_->GetDecoderInfo(current_rtp_payload_type_);
|
||||
|
@ -589,8 +589,7 @@ TEST_F(NetEqImplTest, ReorderedPacket) {
|
||||
|
||||
// This test verifies that NetEq can handle the situation where the first
|
||||
// incoming packet is rejected.
|
||||
// Disabled due to https://code.google.com/p/webrtc/issues/detail?id=4021.
|
||||
TEST_F(NetEqImplTest, DISABLED_FirstPacketUnknown) {
|
||||
TEST_F(NetEqImplTest, FirstPacketUnknown) {
|
||||
UseNoMocks();
|
||||
CreateInstance();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user