summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 10:05:02 +0000
committerxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 10:05:02 +0000
commit6c3e357ac3938a6a08069ef4533b5977113a763f (patch)
tree0174fbff947f38294667069df52b71905ab1000a /content
parentce145c0884c19c9946831ccf082c4c15b755f5cc (diff)
downloadchromium_src-6c3e357ac3938a6a08069ef4533b5977113a763f.zip
chromium_src-6c3e357ac3938a6a08069ef4533b5977113a763f.tar.gz
chromium_src-6c3e357ac3938a6a08069ef4533b5977113a763f.tar.bz2
Reland 10907055 which does:
We need to set the session id to the WebRtcAudioDevice to be able to use the correct microphone which is selected by the users via infobar. This patch also fix the problem that LocalMediaStream.stop does not stop audio recording. TBR=tommi@chromium.org BUG=146308, 140444 TEST=manual tests: using apprtc.appspot.com, make sure the correct microphone is used. http://neave.com/webcam/html5/ Review URL: https://chromiumcodereview.appspot.com/10910108 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155161 0039d316-1c4b-4281-b951-d872f2087c98
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_);