Revert of Revert Make the new jitter buffer the default jitter buffer. (patchset #1 id:1 of https://codereview.chromium.org/2682073003/ )
Reason for revert:
Fix here: https://codereview.chromium.org/2708593003
Original issue's description:
> Revert Make the new jitter buffer the default jitter buffer.
>
> Speculative revert of https://codereview.chromium.org/2656983002/ to see if it fixes a downstream bug.
>
> BUG=webrtc:5514
>
> Review-Url: https://codereview.webrtc.org/2682073003
> Cr-Commit-Position: refs/heads/master@{#16492}
> Committed: e525d6aba6
TBR=nisse@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5514
Review-Url: https://codereview.webrtc.org/2704183002
Cr-Commit-Position: refs/heads/master@{#16772}
This commit is contained in:
@ -25,6 +25,9 @@
|
||||
#include "webrtc/test/gmock.h"
|
||||
#include "webrtc/test/gtest.h"
|
||||
|
||||
using testing::_;
|
||||
using testing::Return;
|
||||
|
||||
namespace webrtc {
|
||||
namespace video_coding {
|
||||
|
||||
@ -54,6 +57,16 @@ class VCMTimingFake : public VCMTiming {
|
||||
return std::max<int>(0, render_time_ms - now_ms - kDecodeTime);
|
||||
}
|
||||
|
||||
bool GetTimings(int* decode_ms,
|
||||
int* max_decode_ms,
|
||||
int* current_delay_ms,
|
||||
int* target_delay_ms,
|
||||
int* jitter_buffer_ms,
|
||||
int* min_playout_delay_ms,
|
||||
int* render_delay_ms) const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr int kDelayMs = 50;
|
||||
static constexpr int kDecodeTime = kDelayMs / 2;
|
||||
@ -82,6 +95,27 @@ class FrameObjectFake : public FrameObject {
|
||||
int64_t ReceivedTime() const override { return 0; }
|
||||
|
||||
int64_t RenderTime() const override { return _renderTimeMs; }
|
||||
|
||||
// In EncodedImage |_length| is used to descibe its size and |_size| to
|
||||
// describe its capacity.
|
||||
void SetSize(int size) { _length = size; }
|
||||
};
|
||||
|
||||
class VCMReceiveStatisticsCallbackMock : public VCMReceiveStatisticsCallback {
|
||||
public:
|
||||
MOCK_METHOD2(OnReceiveRatesUpdated,
|
||||
void(uint32_t bitRate, uint32_t frameRate));
|
||||
MOCK_METHOD2(OnCompleteFrame, void(bool is_keyframe, size_t size_bytes));
|
||||
MOCK_METHOD1(OnDiscardedPacketsUpdated, void(int discarded_packets));
|
||||
MOCK_METHOD1(OnFrameCountsUpdated, void(const FrameCounts& frame_counts));
|
||||
MOCK_METHOD7(OnFrameBufferTimingsUpdated,
|
||||
void(int decode_ms,
|
||||
int max_decode_ms,
|
||||
int current_delay_ms,
|
||||
int target_delay_ms,
|
||||
int jitter_buffer_ms,
|
||||
int min_playout_delay_ms,
|
||||
int render_delay_ms));
|
||||
};
|
||||
|
||||
class TestFrameBuffer2 : public ::testing::Test {
|
||||
@ -95,7 +129,7 @@ class TestFrameBuffer2 : public ::testing::Test {
|
||||
: clock_(0),
|
||||
timing_(&clock_),
|
||||
jitter_estimator_(&clock_),
|
||||
buffer_(&clock_, &jitter_estimator_, &timing_),
|
||||
buffer_(&clock_, &jitter_estimator_, &timing_, &stats_callback_),
|
||||
rand_(0x34678213),
|
||||
tear_down_(false),
|
||||
extract_thread_(&ExtractLoop, this, "Extract Thread"),
|
||||
@ -190,6 +224,7 @@ class TestFrameBuffer2 : public ::testing::Test {
|
||||
FrameBuffer buffer_;
|
||||
std::vector<std::unique_ptr<FrameObject>> frames_;
|
||||
Random rand_;
|
||||
::testing::NiceMock<VCMReceiveStatisticsCallbackMock> stats_callback_;
|
||||
|
||||
int64_t max_wait_time_;
|
||||
bool tear_down_;
|
||||
@ -437,5 +472,30 @@ TEST_F(TestFrameBuffer2, PictureIdJumpBack) {
|
||||
CheckNoFrame(2);
|
||||
}
|
||||
|
||||
TEST_F(TestFrameBuffer2, StatsCallback) {
|
||||
uint16_t pid = Rand();
|
||||
uint32_t ts = Rand();
|
||||
const int kFrameSize = 5000;
|
||||
|
||||
EXPECT_CALL(stats_callback_, OnCompleteFrame(true, kFrameSize));
|
||||
EXPECT_CALL(stats_callback_,
|
||||
OnFrameBufferTimingsUpdated(_, _, _, _, _, _, _));
|
||||
|
||||
{
|
||||
std::unique_ptr<FrameObjectFake> frame(new FrameObjectFake());
|
||||
frame->SetSize(kFrameSize);
|
||||
frame->picture_id = pid;
|
||||
frame->spatial_layer = 0;
|
||||
frame->timestamp = ts;
|
||||
frame->num_references = 0;
|
||||
frame->inter_layer_predicted = false;
|
||||
|
||||
EXPECT_EQ(buffer_.InsertFrame(std::move(frame)), pid);
|
||||
}
|
||||
|
||||
ExtractFrame();
|
||||
CheckFrame(0, pid, 0);
|
||||
}
|
||||
|
||||
} // namespace video_coding
|
||||
} // namespace webrtc
|
||||
|
Reference in New Issue
Block a user