| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 blink::WebVector<blink::WebMediaStreamTrack> audio_track_vector( | 462 blink::WebVector<blink::WebMediaStreamTrack> audio_track_vector( |
| 463 audio_array.size()); | 463 audio_array.size()); |
| 464 CreateAudioTracks(audio_array, audio_constraints, &audio_track_vector, | 464 CreateAudioTracks(audio_array, audio_constraints, &audio_track_vector, |
| 465 request_info); | 465 request_info); |
| 466 | 466 |
| 467 blink::WebVector<blink::WebMediaStreamTrack> video_track_vector( | 467 blink::WebVector<blink::WebMediaStreamTrack> video_track_vector( |
| 468 video_array.size()); | 468 video_array.size()); |
| 469 CreateVideoTracks(video_array, video_constraints, &video_track_vector, | 469 CreateVideoTracks(video_array, video_constraints, &video_track_vector, |
| 470 request_info); | 470 request_info); |
| 471 | 471 |
| 472 blink::WebString webkit_id = base::UTF8ToUTF16(label); | 472 blink::WebString webkit_id = blink::WebString::fromUTF8(label); |
| 473 blink::WebMediaStream* web_stream = &(request_info->web_stream); | 473 blink::WebMediaStream* web_stream = &(request_info->web_stream); |
| 474 | 474 |
| 475 web_stream->initialize(webkit_id, audio_track_vector, | 475 web_stream->initialize(webkit_id, audio_track_vector, |
| 476 video_track_vector); | 476 video_track_vector); |
| 477 web_stream->setExtraData(new MediaStream()); | 477 web_stream->setExtraData(new MediaStream()); |
| 478 | 478 |
| 479 // Wait for the tracks to be started successfully or to fail. | 479 // Wait for the tracks to be started successfully or to fail. |
| 480 request_info->CallbackOnTracksStarted( | 480 request_info->CallbackOnTracksStarted( |
| 481 base::Bind(&UserMediaClientImpl::OnCreateNativeTracksCompleted, | 481 base::Bind(&UserMediaClientImpl::OnCreateNativeTracksCompleted, |
| 482 weak_factory_.GetWeakPtr())); | 482 weak_factory_.GetWeakPtr())); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 blink::WebMediaStreamSource* webkit_source) { | 573 blink::WebMediaStreamSource* webkit_source) { |
| 574 const blink::WebMediaStreamSource* existing_source = | 574 const blink::WebMediaStreamSource* existing_source = |
| 575 FindLocalSource(device); | 575 FindLocalSource(device); |
| 576 if (existing_source) { | 576 if (existing_source) { |
| 577 *webkit_source = *existing_source; | 577 *webkit_source = *existing_source; |
| 578 DVLOG(1) << "Source already exist. Reusing source with id " | 578 DVLOG(1) << "Source already exist. Reusing source with id " |
| 579 << webkit_source->id().utf8(); | 579 << webkit_source->id().utf8(); |
| 580 return; | 580 return; |
| 581 } | 581 } |
| 582 | 582 |
| 583 webkit_source->initialize( | 583 webkit_source->initialize(blink::WebString::fromUTF8(device.device.id), type, |
| 584 base::UTF8ToUTF16(device.device.id), | 584 blink::WebString::fromUTF8(device.device.name), |
| 585 type, | 585 false /* remote */); |
| 586 base::UTF8ToUTF16(device.device.name), | |
| 587 false /* remote */); | |
| 588 | 586 |
| 589 DVLOG(1) << "Initialize source object :" | 587 DVLOG(1) << "Initialize source object :" |
| 590 << "id = " << webkit_source->id().utf8() | 588 << "id = " << webkit_source->id().utf8() |
| 591 << ", name = " << webkit_source->name().utf8(); | 589 << ", name = " << webkit_source->name().utf8(); |
| 592 | 590 |
| 593 if (type == blink::WebMediaStreamSource::TypeVideo) { | 591 if (type == blink::WebMediaStreamSource::TypeVideo) { |
| 594 webkit_source->setExtraData( | 592 webkit_source->setExtraData( |
| 595 CreateVideoSource( | 593 CreateVideoSource( |
| 596 device, | 594 device, |
| 597 base::Bind(&UserMediaClientImpl::OnLocalSourceStopped, | 595 base::Bind(&UserMediaClientImpl::OnLocalSourceStopped, |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 | 1091 |
| 1094 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const { | 1092 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const { |
| 1095 return !sources_waiting_for_callback_.empty(); | 1093 return !sources_waiting_for_callback_.empty(); |
| 1096 } | 1094 } |
| 1097 | 1095 |
| 1098 void UserMediaClientImpl::OnDestruct() { | 1096 void UserMediaClientImpl::OnDestruct() { |
| 1099 delete this; | 1097 delete this; |
| 1100 } | 1098 } |
| 1101 | 1099 |
| 1102 } // namespace content | 1100 } // namespace content |
| OLD | NEW |