Add one API for implementing Initial delay.

R=minyue@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1939004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4475 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
turaj@webrtc.org 2013-08-02 18:07:13 +00:00
parent 89c674053e
commit 7df9706a01
5 changed files with 35 additions and 2 deletions

View File

@ -216,6 +216,12 @@ class NetEq {
// Flushes both the packet buffer and the sync buffer.
virtual void FlushBuffers() = 0;
// Current usage of packet-buffer and it's limits.
virtual void PacketBufferStatistics(int* current_num_packets,
int* max_num_packets,
int* current_memory_size_bytes,
int* max_memory_size_bytes) const = 0;
protected:
NetEq() {}

View File

@ -587,7 +587,6 @@ int NetEqImpl::GetAudioInternal(size_t max_length, int16_t* output,
int decode_return_value = Decode(&packet_list, &operation,
&length, &speech_type);
assert(vad_.get());
bool sid_frame_available =
(operation == kRfc3389Cng && !packet_list.empty());
@ -1633,7 +1632,7 @@ int NetEqImpl::ExtractPackets(int required_samples, PacketList* packet_list) {
if (!header) {
return -1;
}
int32_t first_timestamp = header->timestamp;
uint32_t first_timestamp = header->timestamp;
int extracted_samples = 0;
// Packet extraction loop.
@ -1791,4 +1790,12 @@ NetEqOutputType NetEqImpl::LastOutputType() {
}
}
void NetEqImpl::PacketBufferStatistics(int* current_num_packets,
int* max_num_packets,
int* current_memory_size_bytes,
int* max_memory_size_bytes) const {
packet_buffer_->BufferStat(current_num_packets, max_num_packets,
current_memory_size_bytes, max_memory_size_bytes);
}
} // namespace webrtc

View File

@ -164,6 +164,11 @@ class NetEqImpl : public webrtc::NetEq {
// Flushes both the packet buffer and the sync buffer.
virtual void FlushBuffers();
virtual void PacketBufferStatistics(int* current_num_packets,
int* max_num_packets,
int* current_memory_size_bytes,
int* max_memory_size_bytes) const;
private:
static const int kOutputSizeMs = 10;
static const int kMaxFrameSize = 2880; // 60 ms @ 48 kHz.

View File

@ -275,4 +275,14 @@ void PacketBuffer::DeleteAllPackets(PacketList* packet_list) {
}
}
void PacketBuffer::BufferStat(int* num_packest,
int* max_num_packets,
int* current_memory_bytes,
int* max_memory_bytes) const {
*num_packest = buffer_.size();
*max_num_packets = max_number_of_packets_;
*current_memory_bytes = current_memory_bytes_;
*max_memory_bytes = max_memory_bytes_;
}
} // namespace webrtc

View File

@ -116,6 +116,11 @@ class PacketBuffer {
// The default value for |inc| is 1.
virtual void IncrementWaitingTimes(int inc = 1);
virtual void BufferStat(int* num_packest,
int* max_num_packets,
int* current_memory_bytes,
int* max_memory_bytes) const;
virtual int current_memory_bytes() const { return current_memory_bytes_; }
// Static method that properly deletes the first packet, and its payload