| 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 */); |
| 519 MediaStreamVideoSource* const source = | 520 MediaStreamVideoSource* const source = |
| 520 new VideoSource(weak_factory_.GetWeakPtr()); | 521 new VideoSource(weak_factory_.GetWeakPtr()); |
| 521 webkit_source.setExtraData(source); // Takes ownership of |source|. | 522 webkit_source.setExtraData(source); // Takes ownership of |source|. |
| 522 | 523 |
| 523 const bool enabled = true; | 524 const bool enabled = true; |
| 524 blink::WebMediaConstraints constraints; | 525 blink::WebMediaConstraints constraints; |
| 525 constraints.initialize(); | 526 constraints.initialize(); |
| 526 track_ = MediaStreamVideoTrack::CreateVideoTrack( | 527 track_ = MediaStreamVideoTrack::CreateVideoTrack( |
| 527 source, constraints, | 528 source, constraints, |
| 528 base::Bind( | 529 base::Bind( |
| 529 &PepperMediaStreamVideoTrackHost::OnTrackStarted, | 530 &PepperMediaStreamVideoTrackHost::OnTrackStarted, |
| 530 base::Unretained(this)), | 531 base::Unretained(this)), |
| 531 enabled); | 532 enabled); |
| 532 // Note: The call to CreateVideoTrack() returned a track that holds a | 533 // Note: The call to CreateVideoTrack() returned a track that holds a |
| 533 // ref-counted reference to |webkit_source| (and, implicitly, |source|). | 534 // ref-counted reference to |webkit_source| (and, implicitly, |source|). |
| 534 } | 535 } |
| 535 | 536 |
| 536 void PepperMediaStreamVideoTrackHost::OnTrackStarted( | 537 void PepperMediaStreamVideoTrackHost::OnTrackStarted( |
| 537 MediaStreamSource* source, | 538 MediaStreamSource* source, |
| 538 MediaStreamRequestResult result, | 539 MediaStreamRequestResult result, |
| 539 const blink::WebString& result_name) { | 540 const blink::WebString& result_name) { |
| 540 DVLOG(3) << "OnTrackStarted result: " << result; | 541 DVLOG(3) << "OnTrackStarted result: " << result; |
| 541 } | 542 } |
| 542 | 543 |
| 543 } // namespace content | 544 } // namespace content |
| OLD | NEW |