| 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 */); | 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 track_ = MediaStreamVideoTrack::CreateVideoTrack(source); |
| 529 blink::WebMediaConstraints constraints; | |
| 530 constraints.initialize(); | |
| 531 track_ = MediaStreamVideoTrack::CreateVideoTrack( | |
| 532 source, constraints, | |
| 533 base::Bind( | |
| 534 &PepperMediaStreamVideoTrackHost::OnTrackStarted, | |
| 535 base::Unretained(this)), | |
| 536 enabled); | |
| 537 // Note: The call to CreateVideoTrack() returned a track that holds a | 529 // Note: The call to CreateVideoTrack() returned a track that holds a |
| 538 // ref-counted reference to |webkit_source| (and, implicitly, |source|). | 530 // ref-counted reference to |webkit_source| (and, implicitly, |source|). |
| 539 } | 531 } |
| 540 | 532 |
| 541 void PepperMediaStreamVideoTrackHost::OnTrackStarted( | |
| 542 MediaStreamSource* source, | |
| 543 MediaStreamRequestResult result, | |
| 544 const blink::WebString& result_name) { | |
| 545 DVLOG(3) << "OnTrackStarted result: " << result; | |
| 546 } | |
| 547 | |
| 548 } // namespace content | 533 } // namespace content |
| OLD | NEW |