| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/media/webrtc/peer_connection_dependency_factory.h" | 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 19 #include "base/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
| 23 #include "base/threading/thread_task_runner_handle.h" |
| 23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 24 #include "content/common/media/media_stream_messages.h" | 25 #include "content/common/media/media_stream_messages.h" |
| 25 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
| 26 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 27 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" | 28 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" |
| 28 #include "content/public/common/features.h" | 29 #include "content/public/common/features.h" |
| 29 #include "content/public/common/renderer_preferences.h" | 30 #include "content/public/common/renderer_preferences.h" |
| 30 #include "content/public/common/webrtc_ip_handling_policy.h" | 31 #include "content/public/common/webrtc_ip_handling_policy.h" |
| 31 #include "content/public/renderer/content_renderer_client.h" | 32 #include "content/public/renderer/content_renderer_client.h" |
| 32 #include "content/renderer/media/media_stream.h" | 33 #include "content/renderer/media/media_stream.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 480 |
| 480 void PeerConnectionDependencyFactory::TryScheduleStunProbeTrial() { | 481 void PeerConnectionDependencyFactory::TryScheduleStunProbeTrial() { |
| 481 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 482 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 482 | 483 |
| 483 if (!cmd_line->HasSwitch(switches::kWebRtcStunProbeTrialParameter)) | 484 if (!cmd_line->HasSwitch(switches::kWebRtcStunProbeTrialParameter)) |
| 484 return; | 485 return; |
| 485 | 486 |
| 486 // The underneath IPC channel has to be connected before sending any IPC | 487 // The underneath IPC channel has to be connected before sending any IPC |
| 487 // message. | 488 // message. |
| 488 if (!p2p_socket_dispatcher_->connected()) { | 489 if (!p2p_socket_dispatcher_->connected()) { |
| 489 base::MessageLoop::current()->PostDelayedTask( | 490 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 490 FROM_HERE, | 491 FROM_HERE, |
| 491 base::Bind(&PeerConnectionDependencyFactory::TryScheduleStunProbeTrial, | 492 base::Bind(&PeerConnectionDependencyFactory::TryScheduleStunProbeTrial, |
| 492 base::Unretained(this)), | 493 base::Unretained(this)), |
| 493 base::TimeDelta::FromSeconds(1)); | 494 base::TimeDelta::FromSeconds(1)); |
| 494 return; | 495 return; |
| 495 } | 496 } |
| 496 | 497 |
| 497 // GetPcFactory could trigger an IPC message. If done before | 498 // GetPcFactory could trigger an IPC message. If done before |
| 498 // |p2p_socket_dispatcher_| is connected, that'll put the | 499 // |p2p_socket_dispatcher_| is connected, that'll put the |
| 499 // |p2p_socket_dispatcher_| in a bad state such that no other IPC message can | 500 // |p2p_socket_dispatcher_| in a bad state such that no other IPC message can |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 | 576 |
| 576 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 577 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
| 577 DCHECK(CalledOnValidThread()); | 578 DCHECK(CalledOnValidThread()); |
| 578 if (audio_device_.get()) | 579 if (audio_device_.get()) |
| 579 return; | 580 return; |
| 580 | 581 |
| 581 audio_device_ = new WebRtcAudioDeviceImpl(); | 582 audio_device_ = new WebRtcAudioDeviceImpl(); |
| 582 } | 583 } |
| 583 | 584 |
| 584 } // namespace content | 585 } // namespace content |
| OLD | NEW |