Remove the last getters from VideoReceiveStream stats.

R=stefan@webrtc.org
BUG=1667

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7965 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org
2014-12-19 15:45:03 +00:00
parent 742386a136
commit 5570769210
14 changed files with 75 additions and 77 deletions

View File

@ -582,8 +582,6 @@ public:
EncodedImageCallback* observer) = 0;
virtual void RegisterPostEncodeImageCallback(
EncodedImageCallback* post_encode_callback) = 0;
virtual void RegisterReceiveFrameCountObserver(
FrameCountObserver* frame_count_observer) = 0;
};
} // namespace webrtc

View File

@ -109,8 +109,9 @@ class VCMSendStatisticsCallback {
// Callback class used for informing the user of the incoming bit rate and frame rate.
class VCMReceiveStatisticsCallback {
public:
virtual int32_t OnReceiveStatisticsUpdate(const uint32_t bitRate,
const uint32_t frameRate) = 0;
virtual void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) = 0;
virtual void OnDiscardedPacketsUpdated(int discarded_packets) = 0;
virtual void OnFrameCountsUpdated(const FrameCounts& frame_counts) = 0;
protected:
virtual ~VCMReceiveStatisticsCallback() {

View File

@ -124,7 +124,7 @@ VCMJitterBuffer::VCMJitterBuffer(Clock* clock, EventFactory* event_factory)
incomplete_frames_(),
last_decoded_state_(),
first_packet_since_reset_(true),
frame_count_observer_(NULL),
stats_callback_(NULL),
incoming_frame_rate_(0),
incoming_frame_count_(0),
time_last_incoming_frame_count_(0),
@ -570,6 +570,8 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(const VCMPacket& packet,
if (packet.sizeBytes > 0) {
num_discarded_packets_++;
num_consecutive_old_packets_++;
if (stats_callback_ != NULL)
stats_callback_->OnDiscardedPacketsUpdated(num_discarded_packets_);
}
// Update last decoded sequence number if the packet arrived late and
// belongs to a frame with a timestamp equal to the last decoded
@ -1040,10 +1042,10 @@ void VCMJitterBuffer::RenderBufferSize(uint32_t* timestamp_start,
*timestamp_end = decodable_frames_.Back()->TimeStamp();
}
void VCMJitterBuffer::RegisterFrameCountObserver(
FrameCountObserver* frame_count_observer) {
void VCMJitterBuffer::RegisterStatsCallback(
VCMReceiveStatisticsCallback* callback) {
CriticalSectionScoped cs(crit_sect_);
frame_count_observer_ = frame_count_observer;
stats_callback_ = callback;
}
VCMFrameBuffer* VCMJitterBuffer::GetEmptyFrame() {
@ -1118,8 +1120,8 @@ void VCMJitterBuffer::CountFrame(const VCMFrameBuffer& frame) {
} else {
++receive_statistics_.delta_frames;
}
if (frame_count_observer_ != NULL)
frame_count_observer_->FrameCountUpdated(receive_statistics_, 0);
if (stats_callback_ != NULL)
stats_callback_->OnFrameCountsUpdated(receive_statistics_);
}
}

View File

@ -184,7 +184,7 @@ class VCMJitterBuffer {
// corresponding to the start and end of the continuous complete buffer.
void RenderBufferSize(uint32_t* timestamp_start, uint32_t* timestamp_end);
void RegisterFrameCountObserver(FrameCountObserver* observer);
void RegisterStatsCallback(VCMReceiveStatisticsCallback* callback);
private:
class SequenceNumberLessThan {
@ -303,8 +303,8 @@ class VCMJitterBuffer {
bool first_packet_since_reset_;
// Statistics.
VCMReceiveStatisticsCallback* stats_callback_ GUARDED_BY(crit_sect_);
// Frame counts for each type (key, delta, ...)
FrameCountObserver* frame_count_observer_ GUARDED_BY(crit_sect_);
FrameCounts receive_statistics_;
// Latest calculated frame rates of incoming stream.
unsigned int incoming_frame_rate_;

View File

@ -270,9 +270,9 @@ int VCMReceiver::RenderBufferSizeMs() {
return render_end - render_start;
}
void VCMReceiver::RegisterFrameCountObserver(
FrameCountObserver* frame_count_observer) {
jitter_buffer_.RegisterFrameCountObserver(frame_count_observer);
void VCMReceiver::RegisterStatsCallback(
VCMReceiveStatisticsCallback* callback) {
jitter_buffer_.RegisterStatsCallback(callback);
}
} // namespace webrtc

View File

@ -79,7 +79,7 @@ class VCMReceiver {
// the time this function is called.
int RenderBufferSizeMs();
void RegisterFrameCountObserver(FrameCountObserver* frame_count_observer);
void RegisterStatsCallback(VCMReceiveStatisticsCallback* callback);
private:
static int32_t GenerateReceiverId();

View File

@ -278,11 +278,6 @@ class VideoCodingModuleImpl : public VideoCodingModule {
return receiver_->RegisterRenderBufferSizeCallback(callback);
}
virtual void RegisterReceiveFrameCountObserver(
FrameCountObserver* frame_count_observer) OVERRIDE {
receiver_->RegisterFrameCountObserver(frame_count_observer);
}
virtual int32_t Decode(uint16_t maxWaitTimeMs) OVERRIDE {
return receiver_->Decode(maxWaitTimeMs);
}

View File

@ -182,7 +182,6 @@ class VideoReceiver {
int32_t Process();
void RegisterPreDecodeImageCallback(EncodedImageCallback* observer);
void RegisterFrameCountObserver(FrameCountObserver* frame_count_observer);
protected:
int32_t Decode(const webrtc::VCMEncodedFrame& frame)

View File

@ -74,7 +74,7 @@ int32_t VideoReceiver::Process() {
uint32_t bitRate;
uint32_t frameRate;
_receiver.ReceiveStatistics(&bitRate, &frameRate);
_receiveStatsCallback->OnReceiveStatisticsUpdate(bitRate, frameRate);
_receiveStatsCallback->OnReceiveRatesUpdated(bitRate, frameRate);
}
if (_decoderTimingCallback != NULL) {
@ -284,6 +284,7 @@ int32_t VideoReceiver::RegisterReceiveCallback(
int32_t VideoReceiver::RegisterReceiveStatisticsCallback(
VCMReceiveStatisticsCallback* receiveStats) {
CriticalSectionScoped cs(process_crit_sect_.get());
_receiver.RegisterStatsCallback(receiveStats);
_receiveStatsCallback = receiveStats;
return VCM_OK;
}
@ -666,10 +667,6 @@ void VideoReceiver::RegisterPreDecodeImageCallback(
CriticalSectionScoped cs(_receiveCritSect);
pre_decode_image_callback_ = observer;
}
void VideoReceiver::RegisterFrameCountObserver(
FrameCountObserver* frame_count_observer) {
_receiver.RegisterFrameCountObserver(frame_count_observer);
}
} // namespace vcm
} // namespace webrtc