summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/renderer/media/media_stream_dependency_factory.cc8
-rw-r--r--content/renderer/media/media_stream_dependency_factory.h4
-rw-r--r--content/renderer/media/media_stream_impl.cc4
-rw-r--r--content/renderer/media/mock_media_stream_dependency_factory.cc3
-rw-r--r--content/renderer/media/mock_media_stream_dependency_factory.h1
-rw-r--r--content/renderer/media/webrtc_audio_device_impl.cc6
6 files changed, 21 insertions, 5 deletions
diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc
index 7d4a52d..a81aa9d 100644
--- a/content/renderer/media/media_stream_dependency_factory.cc
+++ b/content/renderer/media/media_stream_dependency_factory.cc
@@ -86,11 +86,13 @@ bool MediaStreamDependencyFactory::CreatePeerConnectionFactory(
network_manager,
socket_factory);
+ DCHECK(!audio_device_);
+ audio_device_ = new WebRtcAudioDeviceImpl();
talk_base::scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory(
webrtc::CreatePeerConnectionFactory(worker_thread,
signaling_thread,
pa_factory.release(),
- new WebRtcAudioDeviceImpl()));
+ audio_device_));
if (factory.get())
pc_factory_ = factory.release();
}
@@ -150,3 +152,7 @@ webrtc::IceCandidateInterface* MediaStreamDependencyFactory::CreateIceCandidate(
const std::string& sdp) {
return webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, sdp);
}
+
+void MediaStreamDependencyFactory::SetAudioDeviceSessionId(int session_id) {
+ audio_device_->SetSessionId(session_id);
+}
diff --git a/content/renderer/media/media_stream_dependency_factory.h b/content/renderer/media/media_stream_dependency_factory.h
index a6dc9b8..7eb1ab6 100644
--- a/content/renderer/media/media_stream_dependency_factory.h
+++ b/content/renderer/media/media_stream_dependency_factory.h
@@ -34,6 +34,7 @@ class VideoCaptureModule;
}
class VideoCaptureImplManager;
+class WebRtcAudioDeviceImpl;
// Object factory for MediaStreamImpl and PeerConnectionHandler.
class CONTENT_EXPORT MediaStreamDependencyFactory {
@@ -79,9 +80,12 @@ class CONTENT_EXPORT MediaStreamDependencyFactory {
int sdp_mline_index,
const std::string& sdp);
+ virtual void SetAudioDeviceSessionId(int session_id);
+
private:
talk_base::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_;
scoped_refptr<VideoCaptureImplManager> vc_manager_;
+ scoped_refptr<WebRtcAudioDeviceImpl> audio_device_;
DISALLOW_COPY_AND_ASSIGN(MediaStreamDependencyFactory);
};
diff --git a/content/renderer/media/media_stream_impl.cc b/content/renderer/media/media_stream_impl.cc
index c794f05..76d88ee 100644
--- a/content/renderer/media/media_stream_impl.cc
+++ b/content/renderer/media/media_stream_impl.cc
@@ -534,6 +534,10 @@ MediaStreamImpl::CreateNativeLocalMediaStream(
dependency_factory_->CreateLocalAudioTrack(
UTF16ToUTF8(audio_sources[i].id()), NULL));
native_stream->AddTrack(audio_track);
+ // TODO(xians): If the track contains a source, we should set the session id
+ // for the source of the local audio track instead.
+ int audio_session_id = media_stream_dispatcher_->audio_session_id(label, 0);
+ dependency_factory_->SetAudioDeviceSessionId(audio_session_id);
}
// Add video tracks.
diff --git a/content/renderer/media/mock_media_stream_dependency_factory.cc b/content/renderer/media/mock_media_stream_dependency_factory.cc
index c58ce86..98161f0 100644
--- a/content/renderer/media/mock_media_stream_dependency_factory.cc
+++ b/content/renderer/media/mock_media_stream_dependency_factory.cc
@@ -318,3 +318,6 @@ MockMediaStreamDependencyFactory::CreateIceCandidate(
const std::string& sdp) {
return new webrtc::MockIceCandidate(sdp_mid, sdp_mline_index, sdp);
}
+
+void MockMediaStreamDependencyFactory::SetAudioDeviceSessionId(int session_id) {
+}
diff --git a/content/renderer/media/mock_media_stream_dependency_factory.h b/content/renderer/media/mock_media_stream_dependency_factory.h
index 8d99433..a7a2a4e 100644
--- a/content/renderer/media/mock_media_stream_dependency_factory.h
+++ b/content/renderer/media/mock_media_stream_dependency_factory.h
@@ -100,6 +100,7 @@ class MockMediaStreamDependencyFactory : public MediaStreamDependencyFactory {
const std::string& sdp_mid,
int sdp_mline_index,
const std::string& sdp) OVERRIDE;
+ virtual void SetAudioDeviceSessionId(int session_id) OVERRIDE;
private:
bool mock_pc_factory_created_;
diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc
index b6b29ec..820a409 100644
--- a/content/renderer/media/webrtc_audio_device_impl.cc
+++ b/content/renderer/media/webrtc_audio_device_impl.cc
@@ -775,10 +775,8 @@ int32_t WebRtcAudioDeviceImpl::StartRecording() {
}
if (session_id_ <= 0) {
- LOG(WARNING) << session_id_ << " is an invalid session id.";
- // TODO(xians): enable the return -1 when MediaStreamManager can handle
- // AudioInputDeviceManager.
- // return -1;
+ LOG(ERROR) << session_id_ << " is an invalid session id.";
+ return -1;
}
base::AutoLock auto_lock(lock_);