Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/pepper/pepper_media_stream_video_track_host.h" | 5 #include "content/renderer/pepper/pepper_media_stream_video_track_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 // source id instead of track id is used there. | 510 // source id instead of track id is used there. |
| 511 const std::string id = track_.source().id().utf8(); | 511 const std::string id = track_.source().id().utf8(); |
| 512 context->reply_msg = PpapiPluginMsg_MediaStreamVideoTrack_ConfigureReply(id); | 512 context->reply_msg = PpapiPluginMsg_MediaStreamVideoTrack_ConfigureReply(id); |
| 513 return PP_OK; | 513 return PP_OK; |
| 514 } | 514 } |
| 515 | 515 |
| 516 void PepperMediaStreamVideoTrackHost::InitBlinkTrack() { | 516 void PepperMediaStreamVideoTrackHost::InitBlinkTrack() { |
| 517 std::string source_id; | 517 std::string source_id; |
| 518 base::Base64Encode(base::RandBytesAsString(64), &source_id); | 518 base::Base64Encode(base::RandBytesAsString(64), &source_id); |
| 519 blink::WebMediaStreamSource webkit_source; | 519 blink::WebMediaStreamSource webkit_source; |
| 520 webkit_source.initialize(base::UTF8ToUTF16(source_id), | 520 webkit_source.initialize(blink::WebString::fromASCII(source_id), |
| 521 blink::WebMediaStreamSource::TypeVideo, | 521 blink::WebMediaStreamSource::TypeVideo, |
| 522 base::UTF8ToUTF16(kPepperVideoSourceName), | 522 blink::WebString::fromASCII(kPepperVideoSourceName), |
|
kinuko
2016/12/22 06:53:21
Looks like source_id (which is base64 encoded stri
| |
| 523 false /* remote */); | 523 false /* remote */); |
| 524 MediaStreamVideoSource* const source = | 524 MediaStreamVideoSource* const source = |
| 525 new VideoSource(weak_factory_.GetWeakPtr()); | 525 new VideoSource(weak_factory_.GetWeakPtr()); |
| 526 webkit_source.setExtraData(source); // Takes ownership of |source|. | 526 webkit_source.setExtraData(source); // Takes ownership of |source|. |
| 527 | 527 |
| 528 const bool enabled = true; | 528 const bool enabled = true; |
| 529 blink::WebMediaConstraints constraints; | 529 blink::WebMediaConstraints constraints; |
| 530 constraints.initialize(); | 530 constraints.initialize(); |
| 531 track_ = MediaStreamVideoTrack::CreateVideoTrack( | 531 track_ = MediaStreamVideoTrack::CreateVideoTrack( |
| 532 source, constraints, | 532 source, constraints, |
| 533 base::Bind( | 533 base::Bind( |
| 534 &PepperMediaStreamVideoTrackHost::OnTrackStarted, | 534 &PepperMediaStreamVideoTrackHost::OnTrackStarted, |
| 535 base::Unretained(this)), | 535 base::Unretained(this)), |
| 536 enabled); | 536 enabled); |
| 537 // Note: The call to CreateVideoTrack() returned a track that holds a | 537 // Note: The call to CreateVideoTrack() returned a track that holds a |
| 538 // ref-counted reference to |webkit_source| (and, implicitly, |source|). | 538 // ref-counted reference to |webkit_source| (and, implicitly, |source|). |
| 539 } | 539 } |
| 540 | 540 |
| 541 void PepperMediaStreamVideoTrackHost::OnTrackStarted( | 541 void PepperMediaStreamVideoTrackHost::OnTrackStarted( |
| 542 MediaStreamSource* source, | 542 MediaStreamSource* source, |
| 543 MediaStreamRequestResult result, | 543 MediaStreamRequestResult result, |
| 544 const blink::WebString& result_name) { | 544 const blink::WebString& result_name) { |
| 545 DVLOG(3) << "OnTrackStarted result: " << result; | 545 DVLOG(3) << "OnTrackStarted result: " << result; |
| 546 } | 546 } |
| 547 | 547 |
| 548 } // namespace content | 548 } // namespace content |
| OLD | NEW |