diff options
author | nick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-26 04:10:52 +0000 |
---|---|---|
committer | nick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-26 04:10:52 +0000 |
commit | 3e03579257da02d8aedbe21ef3fcb1fddb2fad03 (patch) | |
tree | 62dd28a55e6e49e40e9776bca9581840799fe355 /content/browser/renderer_host/media | |
parent | b48e52e676662a0e3bcdceea36799b03d701c064 (diff) | |
download | chromium_src-3e03579257da02d8aedbe21ef3fcb1fddb2fad03.zip chromium_src-3e03579257da02d8aedbe21ef3fcb1fddb2fad03.tar.gz chromium_src-3e03579257da02d8aedbe21ef3fcb1fddb2fad03.tar.bz2 |
Increase delay required before falling back to timer-based capture.
We've seen several traces recently where the timer was kicking in too early
on video content.
BUG=235502,226723
TEST=content_unittests
Review URL: https://chromiumcodereview.appspot.com/14203010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196596 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/media')
-rw-r--r-- | content/browser/renderer_host/media/web_contents_video_capture_device.cc | 2 | ||||
-rw-r--r-- | content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc | 30 |
2 files changed, 17 insertions, 15 deletions
diff --git a/content/browser/renderer_host/media/web_contents_video_capture_device.cc b/content/browser/renderer_host/media/web_contents_video_capture_device.cc index d96d9d4..43031d92 100644 --- a/content/browser/renderer_host/media/web_contents_video_capture_device.cc +++ b/content/browser/renderer_host/media/web_contents_video_capture_device.cc @@ -1344,7 +1344,7 @@ bool SmoothEventSampler::IsOverdueForSamplingAt(base::Time event_time) const { // If we're dirty but not yet old, then we've recently gotten updates, so we // won't request a sample just yet. base::TimeDelta dirty_interval = event_time - last_sample_; - if (dirty_interval < capture_period_ * 2) + if (dirty_interval < capture_period_ * 4) return false; else return true; diff --git a/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc b/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc index 46ab603c..0e9a1b2 100644 --- a/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc +++ b/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc @@ -759,7 +759,7 @@ void TestRedundantCaptureStrategy(base::TimeDelta capture_period, // After more than one capture period has passed without considering an event, // we should repeatedly be overdue for sampling. However, once the redundant // capture goal is achieved, we should no longer be overdue for sampling. - *t += capture_period * 2; + *t += capture_period * 4; for (int i = 0; i < redundant_capture_goal; i++) { SCOPED_TRACE(base::StringPrintf("Iteration %d", i)); ASSERT_FALSE(sampler->HasUnrecordedEvent()); @@ -795,9 +795,9 @@ TEST(SmoothEventSamplerTest, Sample60HertzAt30Hertz) { // Now pretend we're limited by backpressure in the pipeline. In this scenario // case we are adding events but not sampling them. - for (int i = 0; i < 7; i++) { + for (int i = 0; i < 20; i++) { SCOPED_TRACE(base::StringPrintf("Iteration %d", i)); - ASSERT_EQ(i >= 3, sampler.IsOverdueForSamplingAt(t)); + ASSERT_EQ(i >= 7, sampler.IsOverdueForSamplingAt(t)); ASSERT_TRUE(sampler.AddEventAndConsiderSampling(t)); ASSERT_TRUE(sampler.HasUnrecordedEvent()); t += vsync; @@ -839,9 +839,9 @@ TEST(SmoothEventSamplerTest, Sample50HertzAt30Hertz) { // Now pretend we're limited by backpressure in the pipeline. In this scenario // case we are adding events but not sampling them. - for (int i = 0; i < 7; i++) { + for (int i = 0; i < 12; i++) { SCOPED_TRACE(base::StringPrintf("Iteration %d", i)); - ASSERT_EQ(i >= 2, sampler.IsOverdueForSamplingAt(t)); + ASSERT_EQ(i >= 5, sampler.IsOverdueForSamplingAt(t)); ASSERT_TRUE(sampler.AddEventAndConsiderSampling(t)); t += vsync; } @@ -887,9 +887,9 @@ TEST(SmoothEventSamplerTest, Sample75HertzAt30Hertz) { // Now pretend we're limited by backpressure in the pipeline. In this scenario // case we are adding events but not sampling them. - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 20; i++) { SCOPED_TRACE(base::StringPrintf("Iteration %d", i)); - ASSERT_EQ(i >= 3, sampler.IsOverdueForSamplingAt(t)); + ASSERT_EQ(i >= 8, sampler.IsOverdueForSamplingAt(t)); ASSERT_TRUE(sampler.AddEventAndConsiderSampling(t)); t += vsync; } @@ -932,7 +932,7 @@ TEST(SmoothEventSamplerTest, Sample30HertzAt30Hertz) { // case we are adding events but not sampling them. for (int i = 0; i < 7; i++) { SCOPED_TRACE(base::StringPrintf("Iteration %d", i)); - ASSERT_EQ(i >= 1, sampler.IsOverdueForSamplingAt(t)); + ASSERT_EQ(i >= 3, sampler.IsOverdueForSamplingAt(t)); ASSERT_TRUE(sampler.AddEventAndConsiderSampling(t)); t += vsync; } @@ -968,7 +968,7 @@ TEST(SmoothEventSamplerTest, Sample24HertzAt30Hertz) { // case we are adding events but not sampling them. for (int i = 0; i < 7; i++) { SCOPED_TRACE(base::StringPrintf("Iteration %d", i)); - ASSERT_EQ(i >= 1, sampler.IsOverdueForSamplingAt(t)); + ASSERT_EQ(i >= 3, sampler.IsOverdueForSamplingAt(t)); ASSERT_TRUE(sampler.AddEventAndConsiderSampling(t)); t += vsync; } @@ -1022,11 +1022,13 @@ TEST(SmoothEventSamplerTest, FallbackToPollingIfUpdatesUnreliable) { should_poll.RecordSample(); // One time period ahead, neither sampler says we're overdue. - t += timer_interval; - ASSERT_FALSE(should_not_poll.IsOverdueForSamplingAt(t)) - << "Sampled last event; should not be dirty."; - ASSERT_FALSE(should_poll.IsOverdueForSamplingAt(t)) - << "Dirty interval has not elapsed yet."; + for (int i = 0; i < 3; i++) { + t += timer_interval; + ASSERT_FALSE(should_not_poll.IsOverdueForSamplingAt(t)) + << "Sampled last event; should not be dirty."; + ASSERT_FALSE(should_poll.IsOverdueForSamplingAt(t)) + << "Dirty interval has not elapsed yet."; + } // Next time period ahead, both samplers say we're overdue. The non-polling // sampler is returning true here because it has been configured to allow one |