NetEq: Implement logging of Delayed Packet Outage Events
Measures the duration of each packet loss concealment (a.k.a. expand) event that is not followed by a merge operation. Having decoded and played packet m−1, the next expected packet is m. If packet m arrives after some time of packet loss concealment, we have a delayed packet outage event. However, if instead packet n>m arrives, we have a lost packet outage event. In NetEq, the two outage types results in different operations. Both types start with expand operations to generate audio to play while the buffer is empty. When a lost packet outage happens, the expand operation(s) are followed by one merge operation. For delayed packet outages, merge is not done, and the expand operations are immediately followed by normal operations. This change also includes unit tests for the new statistics. BUG=webrtc:4915, chromium:488124 R=minyue@webrtc.org Review URL: https://codereview.webrtc.org/1290113002 . Cr-Commit-Position: refs/heads/master@{#9725}
This commit is contained in:
@ -10,6 +10,8 @@
|
||||
|
||||
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
@ -37,6 +39,25 @@ bool InputAudioFile::Read(size_t samples, int16_t* destination) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputAudioFile::Seek(int samples) {
|
||||
if (!fp_) {
|
||||
return false;
|
||||
}
|
||||
// Find file boundaries.
|
||||
const long current_pos = ftell(fp_);
|
||||
CHECK_NE(EOF, current_pos) << "Error returned when getting file position.";
|
||||
CHECK_EQ(0, fseek(fp_, 0, SEEK_END)); // Move to end of file.
|
||||
const long file_size = ftell(fp_);
|
||||
CHECK_NE(EOF, file_size) << "Error returned when getting file position.";
|
||||
// Find new position.
|
||||
long new_pos = current_pos + sizeof(int16_t) * samples; // Samples to bytes.
|
||||
CHECK_GE(new_pos, 0) << "Trying to move to before the beginning of the file";
|
||||
new_pos = new_pos % file_size; // Wrap around the end of the file.
|
||||
// Move to new position relative to the beginning of the file.
|
||||
CHECK_EQ(0, fseek(fp_, new_pos, SEEK_SET));
|
||||
return true;
|
||||
}
|
||||
|
||||
void InputAudioFile::DuplicateInterleaved(const int16_t* source, size_t samples,
|
||||
size_t channels,
|
||||
int16_t* destination) {
|
||||
|
||||
@ -34,6 +34,12 @@ class InputAudioFile {
|
||||
// The output |destination| must have the capacity to hold |samples| elements.
|
||||
virtual bool Read(size_t samples, int16_t* destination);
|
||||
|
||||
// Fast-forwards (|samples| > 0) or -backwards (|samples| < 0) the file by the
|
||||
// indicated number of samples. Just like Read(), Seek() starts over at the
|
||||
// beginning of the file if the end is reached. However, seeking backwards
|
||||
// past the beginning of the file is not possible.
|
||||
virtual bool Seek(int samples);
|
||||
|
||||
// Creates a multi-channel signal from a mono signal. Each sample is repeated
|
||||
// |channels| times to create an interleaved multi-channel signal where all
|
||||
// channels are identical. The output |destination| must have the capacity to
|
||||
|
||||
Reference in New Issue
Block a user