OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/user_media_client_impl.h" | 5 #include "content/renderer/media/user_media_client_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 blink::WebVector<blink::WebMediaStreamTrack> audio_track_vector( | 436 blink::WebVector<blink::WebMediaStreamTrack> audio_track_vector( |
437 audio_array.size()); | 437 audio_array.size()); |
438 CreateAudioTracks(audio_array, request_info->request.audioConstraints(), | 438 CreateAudioTracks(audio_array, request_info->request.audioConstraints(), |
439 &audio_track_vector, request_info); | 439 &audio_track_vector, request_info); |
440 | 440 |
441 blink::WebVector<blink::WebMediaStreamTrack> video_track_vector( | 441 blink::WebVector<blink::WebMediaStreamTrack> video_track_vector( |
442 video_array.size()); | 442 video_array.size()); |
443 CreateVideoTracks(video_array, request_info->request.videoConstraints(), | 443 CreateVideoTracks(video_array, request_info->request.videoConstraints(), |
444 &video_track_vector, request_info); | 444 &video_track_vector, request_info); |
445 | 445 |
446 blink::WebString webkit_id = base::UTF8ToUTF16(label); | 446 blink::WebString webkit_id = blink::WebString::fromUTF8(label); |
447 blink::WebMediaStream* web_stream = &(request_info->web_stream); | 447 blink::WebMediaStream* web_stream = &(request_info->web_stream); |
448 | 448 |
449 web_stream->initialize(webkit_id, audio_track_vector, | 449 web_stream->initialize(webkit_id, audio_track_vector, |
450 video_track_vector); | 450 video_track_vector); |
451 web_stream->setExtraData(new MediaStream()); | 451 web_stream->setExtraData(new MediaStream()); |
452 | 452 |
453 // Wait for the tracks to be started successfully or to fail. | 453 // Wait for the tracks to be started successfully or to fail. |
454 request_info->CallbackOnTracksStarted( | 454 request_info->CallbackOnTracksStarted( |
455 base::Bind(&UserMediaClientImpl::OnCreateNativeTracksCompleted, | 455 base::Bind(&UserMediaClientImpl::OnCreateNativeTracksCompleted, |
456 weak_factory_.GetWeakPtr())); | 456 weak_factory_.GetWeakPtr())); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 blink::WebMediaStreamSource* webkit_source) { | 547 blink::WebMediaStreamSource* webkit_source) { |
548 const blink::WebMediaStreamSource* existing_source = | 548 const blink::WebMediaStreamSource* existing_source = |
549 FindLocalSource(device); | 549 FindLocalSource(device); |
550 if (existing_source) { | 550 if (existing_source) { |
551 *webkit_source = *existing_source; | 551 *webkit_source = *existing_source; |
552 DVLOG(1) << "Source already exist. Reusing source with id " | 552 DVLOG(1) << "Source already exist. Reusing source with id " |
553 << webkit_source->id().utf8(); | 553 << webkit_source->id().utf8(); |
554 return; | 554 return; |
555 } | 555 } |
556 | 556 |
557 webkit_source->initialize( | 557 webkit_source->initialize(blink::WebString::fromUTF8(device.device.id), type, |
558 base::UTF8ToUTF16(device.device.id), | 558 blink::WebString::fromUTF8(device.device.name), |
559 type, | 559 false /* remote */); |
560 base::UTF8ToUTF16(device.device.name), | |
561 false /* remote */); | |
562 | 560 |
563 DVLOG(1) << "Initialize source object :" | 561 DVLOG(1) << "Initialize source object :" |
564 << "id = " << webkit_source->id().utf8() | 562 << "id = " << webkit_source->id().utf8() |
565 << ", name = " << webkit_source->name().utf8(); | 563 << ", name = " << webkit_source->name().utf8(); |
566 | 564 |
567 if (type == blink::WebMediaStreamSource::TypeVideo) { | 565 if (type == blink::WebMediaStreamSource::TypeVideo) { |
568 webkit_source->setExtraData( | 566 webkit_source->setExtraData( |
569 CreateVideoSource( | 567 CreateVideoSource( |
570 device, | 568 device, |
571 base::Bind(&UserMediaClientImpl::OnLocalSourceStopped, | 569 base::Bind(&UserMediaClientImpl::OnLocalSourceStopped, |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 | 1065 |
1068 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const { | 1066 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const { |
1069 return !sources_waiting_for_callback_.empty(); | 1067 return !sources_waiting_for_callback_.empty(); |
1070 } | 1068 } |
1071 | 1069 |
1072 void UserMediaClientImpl::OnDestruct() { | 1070 void UserMediaClientImpl::OnDestruct() { |
1073 delete this; | 1071 delete this; |
1074 } | 1072 } |
1075 | 1073 |
1076 } // namespace content | 1074 } // namespace content |
OLD | NEW |