Reorder and add critical section to the public method NetEqImpl::PacketBufferStatistics().

R=henrik.lundin@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4644 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc
index 279401a..6e495d2 100644
--- a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc
@@ -354,6 +354,15 @@
   first_packet_ = true;
 }
 
+void NetEqImpl::PacketBufferStatistics(int* current_num_packets,
+                                       int* max_num_packets,
+                                       int* current_memory_size_bytes,
+                                       int* max_memory_size_bytes) const {
+  CriticalSectionScoped lock(crit_sect_);
+  packet_buffer_->BufferStat(current_num_packets, max_num_packets,
+                             current_memory_size_bytes, max_memory_size_bytes);
+}
+
 int NetEqImpl::DecodedRtpInfo(int* sequence_number, uint32_t* timestamp) {
   CriticalSectionScoped lock(crit_sect_);
   if (decoded_packet_sequence_number_ < 0)
@@ -1808,12 +1817,4 @@
   }
 }
 
-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