| 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 context->reply_msg = PpapiPluginMsg_MediaStreamVideoTrack_ConfigureReply(id); | 508 context->reply_msg = PpapiPluginMsg_MediaStreamVideoTrack_ConfigureReply(id); |
| 509 return PP_OK; | 509 return PP_OK; |
| 510 } | 510 } |
| 511 | 511 |
| 512 void PepperMediaStreamVideoTrackHost::InitBlinkTrack() { | 512 void PepperMediaStreamVideoTrackHost::InitBlinkTrack() { |
| 513 std::string source_id; | 513 std::string source_id; |
| 514 base::Base64Encode(base::RandBytesAsString(64), &source_id); | 514 base::Base64Encode(base::RandBytesAsString(64), &source_id); |
| 515 blink::WebMediaStreamSource webkit_source; | 515 blink::WebMediaStreamSource webkit_source; |
| 516 webkit_source.initialize(blink::WebString::fromASCII(source_id), | 516 webkit_source.initialize(blink::WebString::fromASCII(source_id), |
| 517 blink::WebMediaStreamSource::TypeVideo, | 517 blink::WebMediaStreamSource::TypeVideo, |
| 518 blink::WebString::fromASCII(kPepperVideoSourceName), | 518 blink::WebString::fromASCII(kPepperVideoSourceName)); |
| 519 false /* remote */); | |
| 520 MediaStreamVideoSource* const source = | 519 MediaStreamVideoSource* const source = |
| 521 new VideoSource(weak_factory_.GetWeakPtr()); | 520 new VideoSource(weak_factory_.GetWeakPtr()); |
| 522 webkit_source.setExtraData(source); // Takes ownership of |source|. | 521 webkit_source.setExtraData(source); // Takes ownership of |source|. |
| 523 | 522 |
| 524 const bool enabled = true; | 523 const bool enabled = true; |
| 525 blink::WebMediaConstraints constraints; | 524 blink::WebMediaConstraints constraints; |
| 526 constraints.initialize(); | 525 constraints.initialize(); |
| 527 track_ = MediaStreamVideoTrack::CreateVideoTrack( | 526 track_ = MediaStreamVideoTrack::CreateVideoTrack( |
| 528 source, constraints, | 527 source, constraints, |
| 529 base::Bind( | 528 base::Bind( |
| 530 &PepperMediaStreamVideoTrackHost::OnTrackStarted, | 529 &PepperMediaStreamVideoTrackHost::OnTrackStarted, |
| 531 base::Unretained(this)), | 530 base::Unretained(this)), |
| 532 enabled); | 531 enabled); |
| 533 // Note: The call to CreateVideoTrack() returned a track that holds a | 532 // Note: The call to CreateVideoTrack() returned a track that holds a |
| 534 // ref-counted reference to |webkit_source| (and, implicitly, |source|). | 533 // ref-counted reference to |webkit_source| (and, implicitly, |source|). |
| 535 } | 534 } |
| 536 | 535 |
| 537 void PepperMediaStreamVideoTrackHost::OnTrackStarted( | 536 void PepperMediaStreamVideoTrackHost::OnTrackStarted( |
| 538 MediaStreamSource* source, | 537 MediaStreamSource* source, |
| 539 MediaStreamRequestResult result, | 538 MediaStreamRequestResult result, |
| 540 const blink::WebString& result_name) { | 539 const blink::WebString& result_name) { |
| 541 DVLOG(3) << "OnTrackStarted result: " << result; | 540 DVLOG(3) << "OnTrackStarted result: " << result; |
| 542 } | 541 } |
| 543 | 542 |
| 544 } // namespace content | 543 } // namespace content |
| OLD | NEW |