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