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:
@ -216,6 +216,12 @@ class NetEq {
|
|||||||
// Flushes both the packet buffer and the sync buffer.
|
// Flushes both the packet buffer and the sync buffer.
|
||||||
virtual void FlushBuffers() = 0;
|
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:
|
protected:
|
||||||
NetEq() {}
|
NetEq() {}
|
||||||
|
|
||||||
|
@ -587,7 +587,6 @@ int NetEqImpl::GetAudioInternal(size_t max_length, int16_t* output,
|
|||||||
int decode_return_value = Decode(&packet_list, &operation,
|
int decode_return_value = Decode(&packet_list, &operation,
|
||||||
&length, &speech_type);
|
&length, &speech_type);
|
||||||
|
|
||||||
|
|
||||||
assert(vad_.get());
|
assert(vad_.get());
|
||||||
bool sid_frame_available =
|
bool sid_frame_available =
|
||||||
(operation == kRfc3389Cng && !packet_list.empty());
|
(operation == kRfc3389Cng && !packet_list.empty());
|
||||||
@ -1633,7 +1632,7 @@ int NetEqImpl::ExtractPackets(int required_samples, PacketList* packet_list) {
|
|||||||
if (!header) {
|
if (!header) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int32_t first_timestamp = header->timestamp;
|
uint32_t first_timestamp = header->timestamp;
|
||||||
int extracted_samples = 0;
|
int extracted_samples = 0;
|
||||||
|
|
||||||
// Packet extraction loop.
|
// 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
|
} // namespace webrtc
|
||||||
|
@ -164,6 +164,11 @@ class NetEqImpl : public webrtc::NetEq {
|
|||||||
// Flushes both the packet buffer and the sync buffer.
|
// Flushes both the packet buffer and the sync buffer.
|
||||||
virtual void FlushBuffers();
|
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:
|
private:
|
||||||
static const int kOutputSizeMs = 10;
|
static const int kOutputSizeMs = 10;
|
||||||
static const int kMaxFrameSize = 2880; // 60 ms @ 48 kHz.
|
static const int kMaxFrameSize = 2880; // 60 ms @ 48 kHz.
|
||||||
|
@ -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
|
} // namespace webrtc
|
||||||
|
@ -116,6 +116,11 @@ class PacketBuffer {
|
|||||||
// The default value for |inc| is 1.
|
// The default value for |inc| is 1.
|
||||||
virtual void IncrementWaitingTimes(int inc = 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_; }
|
virtual int current_memory_bytes() const { return current_memory_bytes_; }
|
||||||
|
|
||||||
// Static method that properly deletes the first packet, and its payload
|
// Static method that properly deletes the first packet, and its payload
|
||||||
|
Reference in New Issue
Block a user