Fix setting VideoCaptureModule and VideoRenderer for local and remote streams.

BUG=
TEST=

Review URL: http://webrtc-codereview.appspot.com/205002

git-svn-id: http://webrtc.googlecode.com/svn/trunk@701 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
perkj@webrtc.org 2011-10-06 16:10:10 +00:00
parent 35a1756502
commit 3a6d4f4268
2 changed files with 16 additions and 4 deletions

View File

@ -106,9 +106,6 @@ LocalVideoTrackHandler::LocalVideoTrackHandler(
VideoTrack* track,
MediaProviderInterface* provider)
: VideoTrackHandler(track, provider) {
// If the Renderer is already set we want to start it.
if (video_track_->GetRenderer().get())
OnRendererChanged();
}
void LocalVideoTrackHandler::OnRendererChanged() {
@ -124,6 +121,11 @@ void LocalVideoTrackHandler::OnStateChanged(
LocalVideoTrack* track = static_cast<LocalVideoTrack*>(video_track_.get());
if (state == VideoTrack::kLive) {
provider_->SetCaptureDevice(track->ssrc(), track->GetVideoCapture());
scoped_refptr<VideoRenderer> renderer(video_track_->GetRenderer());
if (renderer.get())
provider_->SetLocalRenderer(video_track_->ssrc(), renderer->renderer());
else
provider_->SetLocalRenderer(video_track_->ssrc(), NULL);
}
}

View File

@ -238,7 +238,14 @@ void WebRtcSession::SetCaptureDevice(uint32 ssrc,
VideoCaptureModule* camera) {
// should be called from a signaling thread
ASSERT(signaling_thread()->IsCurrent());
// TODO(mallinath): Refactor this when there is support for multiple cameras.
// Register the the VideoCapture Module.
video_channel_->SetCaptureDevice(ssrc, camera);
// Actually associate the video capture module with the ViE channel.
channel_manager_->SetVideoOptions("");
}
void WebRtcSession::SetLocalRenderer(uint32 ssrc,
@ -250,7 +257,10 @@ void WebRtcSession::SetLocalRenderer(uint32 ssrc,
void WebRtcSession::SetRemoteRenderer(uint32 ssrc,
cricket::VideoRenderer* renderer) {
ASSERT(signaling_thread()->IsCurrent());
video_channel_->SetRenderer(ssrc, renderer);
//TODO(mallinath): Only the ssrc = 0 is supported at the moment.
// Only one channel.
video_channel_->SetRenderer(0, renderer);
}
const cricket::SessionDescription* WebRtcSession::ProvideOffer(