| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 19 #include "base/test/scoped_feature_list.h" | 19 #include "base/test/scoped_feature_list.h" |
| 20 #include "base/test/simple_test_tick_clock.h" | 20 #include "base/test/simple_test_tick_clock.h" |
| 21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
| 23 #include "media/base/media_log.h" | 23 #include "media/base/media_log.h" |
| 24 #include "media/base/media_switches.h" | 24 #include "media/base/media_switches.h" |
| 25 #include "media/base/test_helpers.h" | 25 #include "media/base/test_helpers.h" |
| 26 #include "media/base/video_frame_provider_factory.h" | 26 #include "media/base/video_frame_provider_factory.h" |
| 27 #include "media/blink/webmediaplayer_delegate.h" | 27 #include "media/blink/webmediaplayer_delegate.h" |
| 28 #include "media/blink/webmediaplayer_params.h" | 28 #include "media/blink/webmediaplayer_params.h" |
| 29 #include "media/filters/default_demuxer_factory.h" |
| 29 #include "media/renderers/default_renderer_factory.h" | 30 #include "media/renderers/default_renderer_factory.h" |
| 30 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 32 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 33 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| 33 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 34 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 34 #include "third_party/WebKit/public/platform/WebSize.h" | 35 #include "third_party/WebKit/public/platform/WebSize.h" |
| 35 #include "third_party/WebKit/public/web/WebFrameClient.h" | 36 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 36 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 37 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 37 #include "third_party/WebKit/public/web/WebView.h" | 38 #include "third_party/WebKit/public/web/WebView.h" |
| 38 #include "url/gurl.h" | 39 #include "url/gurl.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 nullptr)), | 195 nullptr)), |
| 195 media_log_(new MediaLog()), | 196 media_log_(new MediaLog()), |
| 196 audio_parameters_(TestAudioParameters::Normal()) { | 197 audio_parameters_(TestAudioParameters::Normal()) { |
| 197 web_view_->setMainFrame(web_local_frame_); | 198 web_view_->setMainFrame(web_local_frame_); |
| 198 media_thread_.StartAndWaitForTesting(); | 199 media_thread_.StartAndWaitForTesting(); |
| 199 } | 200 } |
| 200 | 201 |
| 201 void InitializeWebMediaPlayerImpl(bool allow_suspend) { | 202 void InitializeWebMediaPlayerImpl(bool allow_suspend) { |
| 202 wmpi_ = base::MakeUnique<WebMediaPlayerImpl>( | 203 wmpi_ = base::MakeUnique<WebMediaPlayerImpl>( |
| 203 web_local_frame_, &client_, nullptr, &delegate_, | 204 web_local_frame_, &client_, nullptr, &delegate_, |
| 205 base::MakeUnique<DefaultDemuxerFactory>(media_log_), |
| 204 base::MakeUnique<DefaultRendererFactory>( | 206 base::MakeUnique<DefaultRendererFactory>( |
| 205 media_log_, nullptr, DefaultRendererFactory::GetGpuFactoriesCB(), | 207 media_log_, nullptr, DefaultRendererFactory::GetGpuFactoriesCB(), |
| 206 nullptr), | 208 nullptr), |
| 207 url_index_, | 209 url_index_, |
| 208 WebMediaPlayerParams( | 210 WebMediaPlayerParams( |
| 209 WebMediaPlayerParams::DeferLoadCB(), | 211 WebMediaPlayerParams::DeferLoadCB(), |
| 210 scoped_refptr<SwitchableAudioRendererSink>(), media_log_, | 212 scoped_refptr<SwitchableAudioRendererSink>(), media_log_, |
| 211 media_thread_.task_runner(), message_loop_.task_runner(), | 213 media_thread_.task_runner(), message_loop_.task_runner(), |
| 212 message_loop_.task_runner(), WebMediaPlayerParams::Context3DCB(), | 214 message_loop_.task_runner(), WebMediaPlayerParams::Context3DCB(), |
| 213 base::Bind(&OnAdjustAllocatedMemory), nullptr, nullptr, nullptr, | 215 base::Bind(&OnAdjustAllocatedMemory), nullptr, nullptr, nullptr, |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 | 785 |
| 784 // Average keyframe distance is too big. | 786 // Average keyframe distance is too big. |
| 785 SetVideoKeyframeDistanceAverage(base::TimeDelta::FromSeconds(100)); | 787 SetVideoKeyframeDistanceAverage(base::TimeDelta::FromSeconds(100)); |
| 786 SetDuration(base::TimeDelta::FromSeconds(300)); | 788 SetDuration(base::TimeDelta::FromSeconds(300)); |
| 787 EXPECT_FALSE(IsBackgroundOptimizationCandidate()); | 789 EXPECT_FALSE(IsBackgroundOptimizationCandidate()); |
| 788 EXPECT_FALSE(ShouldPauseVideoWhenHidden()); | 790 EXPECT_FALSE(ShouldPauseVideoWhenHidden()); |
| 789 EXPECT_FALSE(ShouldDisableVideoWhenHidden()); | 791 EXPECT_FALSE(ShouldDisableVideoWhenHidden()); |
| 790 } | 792 } |
| 791 | 793 |
| 792 } // namespace media | 794 } // namespace media |
| OLD | NEW |