Refactor receiver.h/.cc.
TEST=video_coding_unittests, vie_auto_test --automated Review URL: https://webrtc-codereview.appspot.com/994008 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3336 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
1926d33344
commit
1ea4b502ef
@ -8,181 +8,153 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "modules/video_coding/main/source/receiver.h"
|
#include "webrtc/modules/video_coding/main/source/receiver.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "modules/video_coding/main/interface/video_coding.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "modules/video_coding/main/source/encoded_frame.h"
|
#include "webrtc/modules/video_coding/main/source/encoded_frame.h"
|
||||||
#include "modules/video_coding/main/source/internal_defines.h"
|
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
||||||
#include "modules/video_coding/main/source/media_opt_util.h"
|
#include "webrtc/modules/video_coding/main/source/media_opt_util.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
#include "webrtc/modules/video_coding/main/source/tick_time_base.h"
|
||||||
#include "system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
VCMReceiver::VCMReceiver(VCMTiming& timing,
|
VCMReceiver::VCMReceiver(VCMTiming* timing,
|
||||||
TickTimeBase* clock,
|
TickTimeBase* clock,
|
||||||
WebRtc_Word32 vcmId,
|
int32_t vcm_id,
|
||||||
WebRtc_Word32 receiverId,
|
int32_t receiver_id,
|
||||||
bool master)
|
bool master)
|
||||||
: _critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_vcmId(vcmId),
|
vcm_id_(vcm_id),
|
||||||
_clock(clock),
|
clock_(clock),
|
||||||
_receiverId(receiverId),
|
receiver_id_(receiver_id),
|
||||||
_master(master),
|
master_(master),
|
||||||
_jitterBuffer(_clock, vcmId, receiverId, master),
|
jitter_buffer_(clock_, vcm_id, receiver_id, master),
|
||||||
_timing(timing),
|
timing_(timing),
|
||||||
_renderWaitEvent(*new VCMEvent()),
|
render_wait_event_(),
|
||||||
_state(kPassive) {}
|
state_(kPassive) {}
|
||||||
|
|
||||||
VCMReceiver::~VCMReceiver()
|
VCMReceiver::~VCMReceiver() {
|
||||||
{
|
render_wait_event_.Set();
|
||||||
_renderWaitEvent.Set();
|
delete crit_sect_;
|
||||||
delete &_renderWaitEvent;
|
|
||||||
delete _critSect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void VCMReceiver::Reset() {
|
||||||
VCMReceiver::Reset()
|
CriticalSectionScoped cs(crit_sect_);
|
||||||
{
|
if (!jitter_buffer_.Running()) {
|
||||||
CriticalSectionScoped cs(_critSect);
|
jitter_buffer_.Start();
|
||||||
if (!_jitterBuffer.Running())
|
} else {
|
||||||
{
|
jitter_buffer_.Flush();
|
||||||
_jitterBuffer.Start();
|
|
||||||
}
|
}
|
||||||
else
|
render_wait_event_.Reset();
|
||||||
{
|
if (master_) {
|
||||||
_jitterBuffer.Flush();
|
state_ = kReceiving;
|
||||||
}
|
} else {
|
||||||
_renderWaitEvent.Reset();
|
state_ = kPassive;
|
||||||
if (_master)
|
|
||||||
{
|
|
||||||
_state = kReceiving;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_state = kPassive;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
int32_t VCMReceiver::Initialize() {
|
||||||
VCMReceiver::Initialize()
|
CriticalSectionScoped cs(crit_sect_);
|
||||||
{
|
|
||||||
CriticalSectionScoped cs(_critSect);
|
|
||||||
Reset();
|
Reset();
|
||||||
if (!_master)
|
if (!master_) {
|
||||||
{
|
|
||||||
SetNackMode(kNoNack);
|
SetNackMode(kNoNack);
|
||||||
}
|
}
|
||||||
return VCM_OK;
|
return VCM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCMReceiver::UpdateRtt(WebRtc_UWord32 rtt)
|
void VCMReceiver::UpdateRtt(uint32_t rtt) {
|
||||||
{
|
jitter_buffer_.UpdateRtt(rtt);
|
||||||
_jitterBuffer.UpdateRtt(rtt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
int32_t VCMReceiver::InsertPacket(const VCMPacket& packet, uint16_t frame_width,
|
||||||
VCMReceiver::InsertPacket(const VCMPacket& packet,
|
uint16_t frame_height) {
|
||||||
WebRtc_UWord16 frameWidth,
|
// Find an empty frame.
|
||||||
WebRtc_UWord16 frameHeight)
|
VCMEncodedFrame* buffer = NULL;
|
||||||
{
|
const int32_t error = jitter_buffer_.GetFrame(packet, buffer);
|
||||||
// Find an empty frame
|
if (error == VCM_OLD_PACKET_ERROR) {
|
||||||
VCMEncodedFrame *buffer = NULL;
|
|
||||||
const WebRtc_Word32 error = _jitterBuffer.GetFrame(packet, buffer);
|
|
||||||
if (error == VCM_OLD_PACKET_ERROR)
|
|
||||||
{
|
|
||||||
return VCM_OK;
|
return VCM_OK;
|
||||||
}
|
} else if (error != VCM_OK) {
|
||||||
else if (error != VCM_OK)
|
|
||||||
{
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(buffer);
|
assert(buffer);
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(_critSect);
|
CriticalSectionScoped cs(crit_sect_);
|
||||||
|
|
||||||
if (frameWidth && frameHeight)
|
if (frame_width && frame_height) {
|
||||||
{
|
buffer->SetEncodedSize(static_cast<uint32_t>(frame_width),
|
||||||
buffer->SetEncodedSize(static_cast<WebRtc_UWord32>(frameWidth),
|
static_cast<uint32_t>(frame_height));
|
||||||
static_cast<WebRtc_UWord32>(frameHeight));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_master)
|
if (master_) {
|
||||||
{
|
// Only trace the primary receiver to make it possible to parse and plot
|
||||||
// Only trace the primary receiver to make it possible
|
// the trace file.
|
||||||
// to parse and plot the trace file.
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
|
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
|
||||||
VCMId(_vcmId, _receiverId),
|
VCMId(vcm_id_, receiver_id_),
|
||||||
"Packet seqNo %u of frame %u at %u",
|
"Packet seq_no %u of frame %u at %u",
|
||||||
packet.seqNum, packet.timestamp,
|
packet.seqNum, packet.timestamp,
|
||||||
MaskWord64ToUWord32(_clock->MillisecondTimestamp()));
|
MaskWord64ToUWord32(clock_->MillisecondTimestamp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const WebRtc_Word64 nowMs = _clock->MillisecondTimestamp();
|
const int64_t now_ms = clock_->MillisecondTimestamp();
|
||||||
|
|
||||||
WebRtc_Word64 renderTimeMs = _timing.RenderTimeMs(packet.timestamp, nowMs);
|
int64_t render_time_ms = timing_->RenderTimeMs(packet.timestamp, now_ms);
|
||||||
|
|
||||||
if (renderTimeMs < 0)
|
if (render_time_ms < 0) {
|
||||||
{
|
// Render time error. Assume that this is due to some change in the
|
||||||
// Render time error. Assume that this is due to some change in
|
// incoming video stream and reset the JB and the timing.
|
||||||
// the incoming video stream and reset the JB and the timing.
|
jitter_buffer_.Flush();
|
||||||
_jitterBuffer.Flush();
|
timing_->Reset(clock_->MillisecondTimestamp());
|
||||||
_timing.Reset(_clock->MillisecondTimestamp());
|
|
||||||
return VCM_FLUSH_INDICATOR;
|
return VCM_FLUSH_INDICATOR;
|
||||||
}
|
} else if (render_time_ms < now_ms - kMaxVideoDelayMs) {
|
||||||
else if (renderTimeMs < nowMs - kMaxVideoDelayMs)
|
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
|
||||||
{
|
VCMId(vcm_id_, receiver_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
|
|
||||||
"This frame should have been rendered more than %u ms ago."
|
"This frame should have been rendered more than %u ms ago."
|
||||||
"Flushing jitter buffer and resetting timing.", kMaxVideoDelayMs);
|
"Flushing jitter buffer and resetting timing.",
|
||||||
_jitterBuffer.Flush();
|
|
||||||
_timing.Reset(_clock->MillisecondTimestamp());
|
|
||||||
return VCM_FLUSH_INDICATOR;
|
|
||||||
}
|
|
||||||
else if (_timing.TargetVideoDelay() > kMaxVideoDelayMs)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
|
|
||||||
"More than %u ms target delay. Flushing jitter buffer and resetting timing.",
|
|
||||||
kMaxVideoDelayMs);
|
kMaxVideoDelayMs);
|
||||||
_jitterBuffer.Flush();
|
jitter_buffer_.Flush();
|
||||||
_timing.Reset(_clock->MillisecondTimestamp());
|
timing_->Reset(clock_->MillisecondTimestamp());
|
||||||
|
return VCM_FLUSH_INDICATOR;
|
||||||
|
} else if (timing_->TargetVideoDelay() > kMaxVideoDelayMs) {
|
||||||
|
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
|
||||||
|
VCMId(vcm_id_, receiver_id_),
|
||||||
|
"More than %u ms target delay. Flushing jitter buffer and"
|
||||||
|
"resetting timing.", kMaxVideoDelayMs);
|
||||||
|
jitter_buffer_.Flush();
|
||||||
|
timing_->Reset(clock_->MillisecondTimestamp());
|
||||||
return VCM_FLUSH_INDICATOR;
|
return VCM_FLUSH_INDICATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First packet received belonging to this frame.
|
// First packet received belonging to this frame.
|
||||||
if (buffer->Length() == 0)
|
if (buffer->Length() == 0) {
|
||||||
{
|
const int64_t now_ms = clock_->MillisecondTimestamp();
|
||||||
const WebRtc_Word64 nowMs = _clock->MillisecondTimestamp();
|
if (master_) {
|
||||||
if (_master)
|
// Only trace the primary receiver to make it possible to parse and plot
|
||||||
{
|
// the trace file.
|
||||||
// Only trace the primary receiver to make it possible to parse and plot the trace file.
|
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
|
||||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
|
VCMId(vcm_id_, receiver_id_),
|
||||||
"First packet of frame %u at %u", packet.timestamp,
|
"First packet of frame %u at %u", packet.timestamp,
|
||||||
MaskWord64ToUWord32(nowMs));
|
MaskWord64ToUWord32(now_ms));
|
||||||
}
|
}
|
||||||
renderTimeMs = _timing.RenderTimeMs(packet.timestamp, nowMs);
|
render_time_ms = timing_->RenderTimeMs(packet.timestamp, now_ms);
|
||||||
if (renderTimeMs >= 0)
|
if (render_time_ms >= 0) {
|
||||||
{
|
buffer->SetRenderTime(render_time_ms);
|
||||||
buffer->SetRenderTime(renderTimeMs);
|
} else {
|
||||||
}
|
buffer->SetRenderTime(now_ms);
|
||||||
else
|
|
||||||
{
|
|
||||||
buffer->SetRenderTime(nowMs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert packet into the jitter buffer
|
// Insert packet into the jitter buffer both media and empty packets.
|
||||||
// both media and empty packets
|
|
||||||
const VCMFrameBufferEnum
|
const VCMFrameBufferEnum
|
||||||
ret = _jitterBuffer.InsertPacket(buffer, packet);
|
ret = jitter_buffer_.InsertPacket(buffer, packet);
|
||||||
if (ret == kFlushIndicator) {
|
if (ret == kFlushIndicator) {
|
||||||
return VCM_FLUSH_INDICATOR;
|
return VCM_FLUSH_INDICATOR;
|
||||||
} else if (ret < 0) {
|
} else if (ret < 0) {
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding,
|
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding,
|
||||||
VCMId(_vcmId, _receiverId),
|
VCMId(vcm_id_, receiver_id_),
|
||||||
"Error inserting packet seqNo=%u, timeStamp=%u",
|
"Error inserting packet seq_no=%u, time_stamp=%u",
|
||||||
packet.seqNum, packet.timestamp);
|
packet.seqNum, packet.timestamp);
|
||||||
return VCM_JITTER_BUFFER_ERROR;
|
return VCM_JITTER_BUFFER_ERROR;
|
||||||
}
|
}
|
||||||
@ -190,306 +162,262 @@ VCMReceiver::InsertPacket(const VCMPacket& packet,
|
|||||||
return VCM_OK;
|
return VCM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMEncodedFrame* VCMReceiver::FrameForDecoding(WebRtc_UWord16 maxWaitTimeMs,
|
VCMEncodedFrame* VCMReceiver::FrameForDecoding(
|
||||||
WebRtc_Word64& nextRenderTimeMs,
|
uint16_t max_wait_time_ms,
|
||||||
bool renderTiming,
|
int64_t& next_render_time_ms,
|
||||||
VCMReceiver* dualReceiver)
|
bool render_timing,
|
||||||
{
|
VCMReceiver* dual_receiver) {
|
||||||
// No need to enter the critical section here since the jitter buffer
|
// No need to enter the critical section here since the jitter buffer
|
||||||
// is thread-safe.
|
// is thread-safe.
|
||||||
FrameType incomingFrameType = kVideoFrameDelta;
|
FrameType incoming_frame_type = kVideoFrameDelta;
|
||||||
nextRenderTimeMs = -1;
|
next_render_time_ms = -1;
|
||||||
const WebRtc_Word64 startTimeMs = _clock->MillisecondTimestamp();
|
const int64_t start_time_ms = clock_->MillisecondTimestamp();
|
||||||
WebRtc_Word64 ret = _jitterBuffer.NextTimestamp(maxWaitTimeMs,
|
int64_t ret = jitter_buffer_.NextTimestamp(max_wait_time_ms,
|
||||||
&incomingFrameType,
|
&incoming_frame_type,
|
||||||
&nextRenderTimeMs);
|
&next_render_time_ms);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
{
|
// No timestamp in jitter buffer at the moment.
|
||||||
// No timestamp in jitter buffer at the moment
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
const WebRtc_UWord32 timeStamp = static_cast<WebRtc_UWord32>(ret);
|
const uint32_t time_stamp = static_cast<uint32_t>(ret);
|
||||||
|
|
||||||
// Update the timing
|
// Update the timing.
|
||||||
_timing.SetRequiredDelay(_jitterBuffer.EstimatedJitterMs());
|
timing_->SetRequiredDelay(jitter_buffer_.EstimatedJitterMs());
|
||||||
_timing.UpdateCurrentDelay(timeStamp);
|
timing_->UpdateCurrentDelay(time_stamp);
|
||||||
|
|
||||||
const WebRtc_Word32 tempWaitTime = maxWaitTimeMs -
|
const int32_t temp_wait_time = max_wait_time_ms -
|
||||||
static_cast<WebRtc_Word32>(_clock->MillisecondTimestamp() - startTimeMs);
|
static_cast<int32_t>(clock_->MillisecondTimestamp() - start_time_ms);
|
||||||
WebRtc_UWord16 newMaxWaitTime = static_cast<WebRtc_UWord16>(VCM_MAX(tempWaitTime, 0));
|
uint16_t new_max_wait_time = static_cast<uint16_t>(VCM_MAX(temp_wait_time,
|
||||||
|
0));
|
||||||
|
|
||||||
VCMEncodedFrame* frame = NULL;
|
VCMEncodedFrame* frame = NULL;
|
||||||
|
|
||||||
if (renderTiming)
|
if (render_timing) {
|
||||||
{
|
frame = FrameForDecoding(new_max_wait_time, next_render_time_ms,
|
||||||
frame = FrameForDecoding(newMaxWaitTime, nextRenderTimeMs, dualReceiver);
|
dual_receiver);
|
||||||
}
|
} else {
|
||||||
else
|
frame = FrameForRendering(new_max_wait_time, next_render_time_ms,
|
||||||
{
|
dual_receiver);
|
||||||
frame = FrameForRendering(newMaxWaitTime, nextRenderTimeMs, dualReceiver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame != NULL)
|
if (frame != NULL) {
|
||||||
{
|
|
||||||
bool retransmitted = false;
|
bool retransmitted = false;
|
||||||
const WebRtc_Word64 lastPacketTimeMs =
|
const int64_t last_packet_time_ms =
|
||||||
_jitterBuffer.LastPacketTime(frame, &retransmitted);
|
jitter_buffer_.LastPacketTime(frame, &retransmitted);
|
||||||
if (lastPacketTimeMs >= 0 && !retransmitted)
|
if (last_packet_time_ms >= 0 && !retransmitted) {
|
||||||
{
|
// We don't want to include timestamps which have suffered from
|
||||||
// We don't want to include timestamps which have suffered from retransmission
|
// retransmission here, since we compensate with extra retransmission
|
||||||
// here, since we compensate with extra retransmission delay within
|
// delay within the jitter estimate.
|
||||||
// the jitter estimate.
|
timing_->IncomingTimestamp(time_stamp, last_packet_time_ms);
|
||||||
_timing.IncomingTimestamp(timeStamp, lastPacketTimeMs);
|
|
||||||
}
|
}
|
||||||
if (dualReceiver != NULL)
|
if (dual_receiver != NULL) {
|
||||||
{
|
dual_receiver->UpdateState(*frame);
|
||||||
dualReceiver->UpdateState(*frame);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMEncodedFrame*
|
VCMEncodedFrame* VCMReceiver::FrameForDecoding(
|
||||||
VCMReceiver::FrameForDecoding(WebRtc_UWord16 maxWaitTimeMs,
|
uint16_t max_wait_time_ms,
|
||||||
WebRtc_Word64 nextRenderTimeMs,
|
int64_t next_render_time_ms,
|
||||||
VCMReceiver* dualReceiver)
|
VCMReceiver* dual_receiver) {
|
||||||
{
|
// How long can we wait until we must decode the next frame.
|
||||||
// How long can we wait until we must decode the next frame
|
uint32_t wait_time_ms = timing_->MaxWaitingTime(
|
||||||
WebRtc_UWord32 waitTimeMs = _timing.MaxWaitingTime(nextRenderTimeMs,
|
next_render_time_ms, clock_->MillisecondTimestamp());
|
||||||
_clock->MillisecondTimestamp());
|
|
||||||
|
|
||||||
// Try to get a complete frame from the jitter buffer
|
// Try to get a complete frame from the jitter buffer.
|
||||||
VCMEncodedFrame* frame = _jitterBuffer.GetCompleteFrameForDecoding(0);
|
VCMEncodedFrame* frame = jitter_buffer_.GetCompleteFrameForDecoding(0);
|
||||||
|
|
||||||
if (frame == NULL && maxWaitTimeMs == 0 && waitTimeMs > 0)
|
if (frame == NULL && max_wait_time_ms == 0 && wait_time_ms > 0) {
|
||||||
{
|
|
||||||
// If we're not allowed to wait for frames to get complete we must
|
// If we're not allowed to wait for frames to get complete we must
|
||||||
// calculate if it's time to decode, and if it's not we will just return
|
// calculate if it's time to decode, and if it's not we will just return
|
||||||
// for now.
|
// for now.
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame == NULL && VCM_MIN(waitTimeMs, maxWaitTimeMs) == 0)
|
if (frame == NULL && VCM_MIN(wait_time_ms, max_wait_time_ms) == 0) {
|
||||||
{
|
// No time to wait for a complete frame, check if we have an incomplete.
|
||||||
// No time to wait for a complete frame,
|
const bool dual_receiver_enabled_and_passive = (dual_receiver != NULL &&
|
||||||
// check if we have an incomplete
|
dual_receiver->State() == kPassive &&
|
||||||
const bool dualReceiverEnabledAndPassive = (dualReceiver != NULL &&
|
dual_receiver->NackMode() == kNackInfinite);
|
||||||
dualReceiver->State() == kPassive &&
|
if (dual_receiver_enabled_and_passive &&
|
||||||
dualReceiver->NackMode() == kNackInfinite);
|
!jitter_buffer_.CompleteSequenceWithNextFrame()) {
|
||||||
if (dualReceiverEnabledAndPassive &&
|
|
||||||
!_jitterBuffer.CompleteSequenceWithNextFrame())
|
|
||||||
{
|
|
||||||
// Jitter buffer state might get corrupt with this frame.
|
// Jitter buffer state might get corrupt with this frame.
|
||||||
dualReceiver->CopyJitterBufferStateFromReceiver(*this);
|
dual_receiver->CopyJitterBufferStateFromReceiver(*this);
|
||||||
frame = _jitterBuffer.GetFrameForDecoding();
|
frame = jitter_buffer_.GetFrameForDecoding();
|
||||||
assert(frame);
|
assert(frame);
|
||||||
} else {
|
} else {
|
||||||
frame = _jitterBuffer.GetFrameForDecoding();
|
frame = jitter_buffer_.GetFrameForDecoding();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (frame == NULL)
|
if (frame == NULL) {
|
||||||
{
|
// Wait for a complete frame.
|
||||||
// Wait for a complete frame
|
frame = jitter_buffer_.GetCompleteFrameForDecoding(max_wait_time_ms);
|
||||||
frame = _jitterBuffer.GetCompleteFrameForDecoding(maxWaitTimeMs);
|
|
||||||
}
|
}
|
||||||
if (frame == NULL)
|
if (frame == NULL) {
|
||||||
{
|
// Get an incomplete frame.
|
||||||
// Get an incomplete frame
|
if (timing_->MaxWaitingTime(next_render_time_ms,
|
||||||
if (_timing.MaxWaitingTime(nextRenderTimeMs,
|
clock_->MillisecondTimestamp()) > 0) {
|
||||||
_clock->MillisecondTimestamp()) > 0)
|
// Still time to wait for a complete frame.
|
||||||
{
|
|
||||||
// Still time to wait for a complete frame
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No time left to wait, we must decode this frame now.
|
// No time left to wait, we must decode this frame now.
|
||||||
const bool dualReceiverEnabledAndPassive = (dualReceiver != NULL &&
|
const bool dual_receiver_enabled_and_passive = (dual_receiver != NULL &&
|
||||||
dualReceiver->State() == kPassive &&
|
dual_receiver->State() == kPassive &&
|
||||||
dualReceiver->NackMode() == kNackInfinite);
|
dual_receiver->NackMode() == kNackInfinite);
|
||||||
if (dualReceiverEnabledAndPassive &&
|
if (dual_receiver_enabled_and_passive &&
|
||||||
!_jitterBuffer.CompleteSequenceWithNextFrame())
|
!jitter_buffer_.CompleteSequenceWithNextFrame()) {
|
||||||
{
|
|
||||||
// Jitter buffer state might get corrupt with this frame.
|
// Jitter buffer state might get corrupt with this frame.
|
||||||
dualReceiver->CopyJitterBufferStateFromReceiver(*this);
|
dual_receiver->CopyJitterBufferStateFromReceiver(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = _jitterBuffer.GetFrameForDecoding();
|
frame = jitter_buffer_.GetFrameForDecoding();
|
||||||
}
|
}
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMEncodedFrame*
|
VCMEncodedFrame* VCMReceiver::FrameForRendering(uint16_t max_wait_time_ms,
|
||||||
VCMReceiver::FrameForRendering(WebRtc_UWord16 maxWaitTimeMs,
|
int64_t next_render_time_ms,
|
||||||
WebRtc_Word64 nextRenderTimeMs,
|
VCMReceiver* dual_receiver) {
|
||||||
VCMReceiver* dualReceiver)
|
// How long MUST we wait until we must decode the next frame. This is
|
||||||
{
|
// different for the case where we have a renderer which can render at a
|
||||||
// How long MUST we wait until we must decode the next frame. This is different for the case
|
// specified time. Here we must wait as long as possible before giving the
|
||||||
// where we have a renderer which can render at a specified time. Here we must wait as long
|
// frame to the decoder, which will render the frame as soon as it has been
|
||||||
// as possible before giving the frame to the decoder, which will render the frame as soon
|
// decoded.
|
||||||
// as it has been decoded.
|
uint32_t wait_time_ms = timing_->MaxWaitingTime(
|
||||||
WebRtc_UWord32 waitTimeMs = _timing.MaxWaitingTime(nextRenderTimeMs,
|
next_render_time_ms, clock_->MillisecondTimestamp());
|
||||||
_clock->MillisecondTimestamp());
|
if (max_wait_time_ms < wait_time_ms) {
|
||||||
if (maxWaitTimeMs < waitTimeMs)
|
|
||||||
{
|
|
||||||
// If we're not allowed to wait until the frame is supposed to be rendered
|
// If we're not allowed to wait until the frame is supposed to be rendered
|
||||||
// we will have to return NULL for now.
|
// we will have to return NULL for now.
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// Wait until it's time to render
|
// Wait until it's time to render.
|
||||||
_renderWaitEvent.Wait(waitTimeMs);
|
render_wait_event_.Wait(wait_time_ms);
|
||||||
|
|
||||||
// Get a complete frame if possible
|
// Get a complete frame if possible.
|
||||||
VCMEncodedFrame* frame = _jitterBuffer.GetCompleteFrameForDecoding(0);
|
VCMEncodedFrame* frame = jitter_buffer_.GetCompleteFrameForDecoding(0);
|
||||||
|
|
||||||
if (frame == NULL)
|
if (frame == NULL) {
|
||||||
{
|
// Get an incomplete frame.
|
||||||
// Get an incomplete frame
|
const bool dual_receiver_enabled_and_passive = (dual_receiver != NULL &&
|
||||||
const bool dualReceiverEnabledAndPassive = dualReceiver != NULL &&
|
dual_receiver->State() == kPassive &&
|
||||||
dualReceiver->State() == kPassive &&
|
dual_receiver->NackMode() == kNackInfinite);
|
||||||
dualReceiver->NackMode() == kNackInfinite;
|
if (dual_receiver_enabled_and_passive &&
|
||||||
if (dualReceiverEnabledAndPassive && !_jitterBuffer.CompleteSequenceWithNextFrame())
|
!jitter_buffer_.CompleteSequenceWithNextFrame()) {
|
||||||
{
|
|
||||||
// Jitter buffer state might get corrupt with this frame.
|
// Jitter buffer state might get corrupt with this frame.
|
||||||
dualReceiver->CopyJitterBufferStateFromReceiver(*this);
|
dual_receiver->CopyJitterBufferStateFromReceiver(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = _jitterBuffer.GetFrameForDecoding();
|
frame = jitter_buffer_.GetFrameForDecoding();
|
||||||
}
|
}
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void VCMReceiver::ReleaseFrame(VCMEncodedFrame* frame) {
|
||||||
VCMReceiver::ReleaseFrame(VCMEncodedFrame* frame)
|
jitter_buffer_.ReleaseFrame(frame);
|
||||||
{
|
|
||||||
_jitterBuffer.ReleaseFrame(frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
void VCMReceiver::ReceiveStatistics(uint32_t* bitrate,
|
||||||
VCMReceiver::ReceiveStatistics(WebRtc_UWord32& bitRate, WebRtc_UWord32& frameRate)
|
uint32_t* framerate) {
|
||||||
{
|
assert(bitrate);
|
||||||
_jitterBuffer.IncomingRateStatistics(&frameRate, &bitRate);
|
assert(framerate);
|
||||||
bitRate /= 1000; // Should be in kbps
|
jitter_buffer_.IncomingRateStatistics(framerate, bitrate);
|
||||||
return 0;
|
*bitrate /= 1000; // Should be in kbps.
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32
|
void VCMReceiver::ReceivedFrameCount(VCMFrameCount* frame_count) const {
|
||||||
VCMReceiver::ReceivedFrameCount(VCMFrameCount& frameCount) const
|
assert(frame_count);
|
||||||
{
|
jitter_buffer_.FrameStatistics(&frame_count->numDeltaFrames,
|
||||||
_jitterBuffer.FrameStatistics(&frameCount.numDeltaFrames,
|
&frame_count->numKeyFrames);
|
||||||
&frameCount.numKeyFrames);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord32 VCMReceiver::DiscardedPackets() const {
|
uint32_t VCMReceiver::DiscardedPackets() const {
|
||||||
return _jitterBuffer.num_discarded_packets();
|
return jitter_buffer_.num_discarded_packets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void VCMReceiver::SetNackMode(VCMNackMode nackMode) {
|
||||||
VCMReceiver::SetNackMode(VCMNackMode nackMode)
|
CriticalSectionScoped cs(crit_sect_);
|
||||||
{
|
|
||||||
CriticalSectionScoped cs(_critSect);
|
|
||||||
// Default to always having NACK enabled in hybrid mode.
|
// Default to always having NACK enabled in hybrid mode.
|
||||||
_jitterBuffer.SetNackMode(nackMode, kLowRttNackMs, -1);
|
jitter_buffer_.SetNackMode(nackMode, kLowRttNackMs, -1);
|
||||||
if (!_master)
|
if (!master_) {
|
||||||
{
|
state_ = kPassive; // The dual decoder defaults to passive.
|
||||||
_state = kPassive; // The dual decoder defaults to passive
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMNackMode
|
VCMNackMode VCMReceiver::NackMode() const {
|
||||||
VCMReceiver::NackMode() const
|
CriticalSectionScoped cs(crit_sect_);
|
||||||
{
|
return jitter_buffer_.nack_mode();
|
||||||
CriticalSectionScoped cs(_critSect);
|
|
||||||
return _jitterBuffer.nack_mode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMNackStatus
|
VCMNackStatus VCMReceiver::NackList(uint16_t* nack_list,
|
||||||
VCMReceiver::NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size)
|
uint16_t* size) {
|
||||||
{
|
|
||||||
bool extended = false;
|
bool extended = false;
|
||||||
WebRtc_UWord16 nackListSize = 0;
|
uint16_t nack_list_size = 0;
|
||||||
WebRtc_UWord16* internalNackList = _jitterBuffer.CreateNackList(
|
uint16_t* internal_nack_list = jitter_buffer_.CreateNackList(&nack_list_size,
|
||||||
&nackListSize, &extended);
|
&extended);
|
||||||
if (internalNackList == NULL && nackListSize == 0xffff)
|
if (internal_nack_list == NULL && nack_list_size == 0xffff) {
|
||||||
{
|
|
||||||
// This combination is used to trigger key frame requests.
|
// This combination is used to trigger key frame requests.
|
||||||
size = 0;
|
*size = 0;
|
||||||
return kNackKeyFrameRequest;
|
return kNackKeyFrameRequest;
|
||||||
}
|
}
|
||||||
if (nackListSize > size)
|
if (nack_list_size > *size) {
|
||||||
{
|
*size = nack_list_size;
|
||||||
size = nackListSize;
|
|
||||||
return kNackNeedMoreMemory;
|
return kNackNeedMoreMemory;
|
||||||
}
|
}
|
||||||
if (internalNackList != NULL && nackListSize > 0) {
|
if (internal_nack_list != NULL && nack_list_size > 0) {
|
||||||
memcpy(nackList, internalNackList, nackListSize * sizeof(WebRtc_UWord16));
|
memcpy(nack_list, internal_nack_list, nack_list_size * sizeof(uint16_t));
|
||||||
}
|
}
|
||||||
size = nackListSize;
|
*size = nack_list_size;
|
||||||
return kNackOk;
|
return kNackOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decide whether we should change decoder state. This should be done if the dual decoder
|
// Decide whether we should change decoder state. This should be done if the
|
||||||
// has caught up with the decoder decoding with packet losses.
|
// dual decoder has caught up with the decoder decoding with packet losses.
|
||||||
bool
|
bool VCMReceiver::DualDecoderCaughtUp(VCMEncodedFrame* dual_frame,
|
||||||
VCMReceiver::DualDecoderCaughtUp(VCMEncodedFrame* dualFrame, VCMReceiver& dualReceiver) const
|
VCMReceiver& dual_receiver) const {
|
||||||
{
|
if (dual_frame == NULL) {
|
||||||
if (dualFrame == NULL)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_jitterBuffer.LastDecodedTimestamp() == dualFrame->TimeStamp())
|
if (jitter_buffer_.LastDecodedTimestamp() == dual_frame->TimeStamp()) {
|
||||||
{
|
dual_receiver.UpdateState(kWaitForPrimaryDecode);
|
||||||
dualReceiver.UpdateState(kWaitForPrimaryDecode);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void VCMReceiver::CopyJitterBufferStateFromReceiver(
|
||||||
VCMReceiver::CopyJitterBufferStateFromReceiver(const VCMReceiver& receiver)
|
const VCMReceiver& receiver) {
|
||||||
{
|
jitter_buffer_.CopyFrom(receiver.jitter_buffer_);
|
||||||
_jitterBuffer.CopyFrom(receiver._jitterBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMReceiverState
|
VCMReceiverState VCMReceiver::State() const {
|
||||||
VCMReceiver::State() const
|
CriticalSectionScoped cs(crit_sect_);
|
||||||
{
|
return state_;
|
||||||
CriticalSectionScoped cs(_critSect);
|
|
||||||
return _state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void VCMReceiver::UpdateState(VCMReceiverState new_state) {
|
||||||
VCMReceiver::UpdateState(VCMReceiverState newState)
|
CriticalSectionScoped cs(crit_sect_);
|
||||||
{
|
assert(!(state_ == kPassive && new_state == kWaitForPrimaryDecode));
|
||||||
CriticalSectionScoped cs(_critSect);
|
state_ = new_state;
|
||||||
assert(!(_state == kPassive && newState == kWaitForPrimaryDecode));
|
|
||||||
// assert(!(_state == kReceiving && newState == kPassive));
|
|
||||||
_state = newState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void VCMReceiver::UpdateState(const VCMEncodedFrame& frame) {
|
||||||
VCMReceiver::UpdateState(VCMEncodedFrame& frame)
|
if (jitter_buffer_.nack_mode() == kNoNack) {
|
||||||
{
|
|
||||||
if (_jitterBuffer.nack_mode() == kNoNack)
|
|
||||||
{
|
|
||||||
// Dual decoder mode has not been enabled.
|
// Dual decoder mode has not been enabled.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Update the dual receiver state
|
// Update the dual receiver state.
|
||||||
if (frame.Complete() && frame.FrameType() == kVideoFrameKey)
|
if (frame.Complete() && frame.FrameType() == kVideoFrameKey) {
|
||||||
{
|
|
||||||
UpdateState(kPassive);
|
UpdateState(kPassive);
|
||||||
}
|
}
|
||||||
if (State() == kWaitForPrimaryDecode &&
|
if (State() == kWaitForPrimaryDecode &&
|
||||||
frame.Complete() && !frame.MissingFrame())
|
frame.Complete() && !frame.MissingFrame()) {
|
||||||
{
|
|
||||||
UpdateState(kPassive);
|
UpdateState(kPassive);
|
||||||
}
|
}
|
||||||
if (frame.MissingFrame() || !frame.Complete())
|
if (frame.MissingFrame() || !frame.Complete()) {
|
||||||
{
|
|
||||||
// State was corrupted, enable dual receiver.
|
// State was corrupted, enable dual receiver.
|
||||||
UpdateState(kReceiving);
|
UpdateState(kReceiving);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // namespace webrtc
|
||||||
}
|
|
||||||
|
@ -8,94 +8,90 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WEBRTC_MODULES_VIDEO_CODING_RECEIVER_H_
|
#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_RECEIVER_H_
|
||||||
#define WEBRTC_MODULES_VIDEO_CODING_RECEIVER_H_
|
#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_RECEIVER_H_
|
||||||
|
|
||||||
#include "critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "jitter_buffer.h"
|
#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
#include "webrtc/modules/video_coding/main/source/packet.h"
|
||||||
#include "timing.h"
|
#include "webrtc/modules/video_coding/main/source/tick_time_base.h"
|
||||||
#include "packet.h"
|
#include "webrtc/modules/video_coding/main/source/timing.h"
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc {
|
||||||
{
|
|
||||||
|
|
||||||
class VCMEncodedFrame;
|
class VCMEncodedFrame;
|
||||||
|
|
||||||
enum VCMNackStatus
|
enum VCMNackStatus {
|
||||||
{
|
|
||||||
kNackOk,
|
kNackOk,
|
||||||
kNackNeedMoreMemory,
|
kNackNeedMoreMemory,
|
||||||
kNackKeyFrameRequest
|
kNackKeyFrameRequest
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum VCMReceiverState {
|
||||||
enum VCMReceiverState
|
|
||||||
{
|
|
||||||
kReceiving,
|
kReceiving,
|
||||||
kPassive,
|
kPassive,
|
||||||
kWaitForPrimaryDecode
|
kWaitForPrimaryDecode
|
||||||
};
|
};
|
||||||
|
|
||||||
class VCMReceiver
|
class VCMReceiver {
|
||||||
{
|
public:
|
||||||
public:
|
VCMReceiver(VCMTiming* timing,
|
||||||
VCMReceiver(VCMTiming& timing,
|
|
||||||
TickTimeBase* clock,
|
TickTimeBase* clock,
|
||||||
WebRtc_Word32 vcmId = -1,
|
int32_t vcm_id = -1,
|
||||||
WebRtc_Word32 receiverId = -1,
|
int32_t receiver_id = -1,
|
||||||
bool master = true);
|
bool master = true);
|
||||||
~VCMReceiver();
|
~VCMReceiver();
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
WebRtc_Word32 Initialize();
|
int32_t Initialize();
|
||||||
void UpdateRtt(WebRtc_UWord32 rtt);
|
void UpdateRtt(uint32_t rtt);
|
||||||
WebRtc_Word32 InsertPacket(const VCMPacket& packet,
|
int32_t InsertPacket(const VCMPacket& packet,
|
||||||
WebRtc_UWord16 frameWidth,
|
uint16_t frame_width,
|
||||||
WebRtc_UWord16 frameHeight);
|
uint16_t frame_height);
|
||||||
VCMEncodedFrame* FrameForDecoding(WebRtc_UWord16 maxWaitTimeMs,
|
VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms,
|
||||||
WebRtc_Word64& nextRenderTimeMs,
|
int64_t& next_render_time_ms,
|
||||||
bool renderTiming = true,
|
bool render_timing = true,
|
||||||
VCMReceiver* dualReceiver = NULL);
|
VCMReceiver* dual_receiver = NULL);
|
||||||
void ReleaseFrame(VCMEncodedFrame* frame);
|
void ReleaseFrame(VCMEncodedFrame* frame);
|
||||||
WebRtc_Word32 ReceiveStatistics(WebRtc_UWord32& bitRate, WebRtc_UWord32& frameRate);
|
void ReceiveStatistics(uint32_t* bitrate, uint32_t* framerate);
|
||||||
WebRtc_Word32 ReceivedFrameCount(VCMFrameCount& frameCount) const;
|
void ReceivedFrameCount(VCMFrameCount* frame_count) const;
|
||||||
WebRtc_UWord32 DiscardedPackets() const;
|
uint32_t DiscardedPackets() const;
|
||||||
|
|
||||||
// NACK
|
// NACK.
|
||||||
void SetNackMode(VCMNackMode nackMode);
|
void SetNackMode(VCMNackMode nackMode);
|
||||||
VCMNackMode NackMode() const;
|
VCMNackMode NackMode() const;
|
||||||
VCMNackStatus NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size);
|
VCMNackStatus NackList(uint16_t* nackList, uint16_t* size);
|
||||||
|
|
||||||
// Dual decoder
|
// Dual decoder.
|
||||||
bool DualDecoderCaughtUp(VCMEncodedFrame* dualFrame, VCMReceiver& dualReceiver) const;
|
bool DualDecoderCaughtUp(VCMEncodedFrame* dual_frame,
|
||||||
|
VCMReceiver& dual_receiver) const;
|
||||||
VCMReceiverState State() const;
|
VCMReceiverState State() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VCMEncodedFrame* FrameForDecoding(WebRtc_UWord16 maxWaitTimeMs,
|
VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms,
|
||||||
WebRtc_Word64 nextrenderTimeMs,
|
int64_t nextrender_time_ms,
|
||||||
VCMReceiver* dualReceiver);
|
VCMReceiver* dual_receiver);
|
||||||
VCMEncodedFrame* FrameForRendering(WebRtc_UWord16 maxWaitTimeMs,
|
VCMEncodedFrame* FrameForRendering(uint16_t max_wait_time_ms,
|
||||||
WebRtc_Word64 nextrenderTimeMs,
|
int64_t nextrender_time_ms,
|
||||||
VCMReceiver* dualReceiver);
|
VCMReceiver* dual_receiver);
|
||||||
void CopyJitterBufferStateFromReceiver(const VCMReceiver& receiver);
|
void CopyJitterBufferStateFromReceiver(const VCMReceiver& receiver);
|
||||||
void UpdateState(VCMReceiverState newState);
|
void UpdateState(VCMReceiverState new_state);
|
||||||
void UpdateState(VCMEncodedFrame& frame);
|
void UpdateState(const VCMEncodedFrame& frame);
|
||||||
static WebRtc_Word32 GenerateReceiverId();
|
static int32_t GenerateReceiverId();
|
||||||
|
|
||||||
CriticalSectionWrapper* _critSect;
|
CriticalSectionWrapper* crit_sect_;
|
||||||
WebRtc_Word32 _vcmId;
|
int32_t vcm_id_;
|
||||||
TickTimeBase* _clock;
|
TickTimeBase* clock_;
|
||||||
WebRtc_Word32 _receiverId;
|
int32_t receiver_id_;
|
||||||
bool _master;
|
bool master_;
|
||||||
VCMJitterBuffer _jitterBuffer;
|
VCMJitterBuffer jitter_buffer_;
|
||||||
VCMTiming& _timing;
|
VCMTiming* timing_;
|
||||||
VCMEvent& _renderWaitEvent;
|
VCMEvent render_wait_event_;
|
||||||
VCMReceiverState _state;
|
VCMReceiverState state_;
|
||||||
|
|
||||||
static WebRtc_Word32 _receiverIdCounter;
|
static int32_t receiver_id_counter_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // WEBRTC_MODULES_VIDEO_CODING_RECEIVER_H_
|
#endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_RECEIVER_H_
|
||||||
|
@ -54,8 +54,8 @@ _receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
|||||||
_receiverInited(false),
|
_receiverInited(false),
|
||||||
_timing(clock_, id, 1),
|
_timing(clock_, id, 1),
|
||||||
_dualTiming(clock_, id, 2, &_timing),
|
_dualTiming(clock_, id, 2, &_timing),
|
||||||
_receiver(_timing, clock_, id, 1),
|
_receiver(&_timing, clock_, id, 1),
|
||||||
_dualReceiver(_dualTiming, clock_, id, 2, false),
|
_dualReceiver(&_dualTiming, clock_, id, 2, false),
|
||||||
_decodedFrameCallback(_timing, clock_),
|
_decodedFrameCallback(_timing, clock_),
|
||||||
_dualDecodedFrameCallback(_dualTiming, clock_),
|
_dualDecodedFrameCallback(_dualTiming, clock_),
|
||||||
_frameTypeCallback(NULL),
|
_frameTypeCallback(NULL),
|
||||||
@ -144,17 +144,9 @@ VideoCodingModuleImpl::Process()
|
|||||||
{
|
{
|
||||||
WebRtc_UWord32 bitRate;
|
WebRtc_UWord32 bitRate;
|
||||||
WebRtc_UWord32 frameRate;
|
WebRtc_UWord32 frameRate;
|
||||||
const WebRtc_Word32 ret = _receiver.ReceiveStatistics(bitRate,
|
_receiver.ReceiveStatistics(&bitRate, &frameRate);
|
||||||
frameRate);
|
|
||||||
if (ret == 0)
|
|
||||||
{
|
|
||||||
_receiveStatsCallback->ReceiveStatistics(bitRate, frameRate);
|
_receiveStatsCallback->ReceiveStatistics(bitRate, frameRate);
|
||||||
}
|
}
|
||||||
else if (returnValue == VCM_OK)
|
|
||||||
{
|
|
||||||
returnValue = ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send-side statistics
|
// Send-side statistics
|
||||||
@ -1255,11 +1247,11 @@ VideoCodingModuleImpl::NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size)
|
|||||||
// the dual receiver if the dual receiver is receiving.
|
// the dual receiver if the dual receiver is receiving.
|
||||||
if (_receiver.NackMode() != kNoNack)
|
if (_receiver.NackMode() != kNoNack)
|
||||||
{
|
{
|
||||||
nackStatus = _receiver.NackList(nackList, size);
|
nackStatus = _receiver.NackList(nackList, &size);
|
||||||
}
|
}
|
||||||
else if (_dualReceiver.State() != kPassive)
|
else if (_dualReceiver.State() != kPassive)
|
||||||
{
|
{
|
||||||
nackStatus = _dualReceiver.NackList(nackList, size);
|
nackStatus = _dualReceiver.NackList(nackList, &size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1294,7 +1286,8 @@ VideoCodingModuleImpl::NackList(WebRtc_UWord16* nackList, WebRtc_UWord16& size)
|
|||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
VideoCodingModuleImpl::ReceivedFrameCount(VCMFrameCount& frameCount) const
|
VideoCodingModuleImpl::ReceivedFrameCount(VCMFrameCount& frameCount) const
|
||||||
{
|
{
|
||||||
return _receiver.ReceivedFrameCount(frameCount);
|
_receiver.ReceivedFrameCount(&frameCount);
|
||||||
|
return VCM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord32 VideoCodingModuleImpl::DiscardedPackets() const {
|
WebRtc_UWord32 VideoCodingModuleImpl::DiscardedPackets() const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user