| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/public/renderer/media_stream_utils.h" | 5 #include "content/public/renderer/media_stream_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 web_media_stream_source.setExtraData(media_stream_source); | 88 web_media_stream_source.setExtraData(media_stream_source); |
| 89 | 89 |
| 90 blink::WebMediaStreamTrack web_media_stream_track; | 90 blink::WebMediaStreamTrack web_media_stream_track; |
| 91 web_media_stream_track.initialize(web_media_stream_source); | 91 web_media_stream_track.initialize(web_media_stream_source); |
| 92 if (!media_stream_source->ConnectToTrack(web_media_stream_track)) | 92 if (!media_stream_source->ConnectToTrack(web_media_stream_track)) |
| 93 return false; | 93 return false; |
| 94 web_media_stream->addTrack(web_media_stream_track); | 94 web_media_stream->addTrack(web_media_stream_track); |
| 95 return true; | 95 return true; |
| 96 } | 96 } |
| 97 | 97 |
| 98 const media::VideoCaptureFormat* GetCurrentVideoTrackFormat( | |
| 99 const blink::WebMediaStreamTrack& video_track) { | |
| 100 if (video_track.isNull()) | |
| 101 return nullptr; | |
| 102 | |
| 103 MediaStreamVideoSource* const source = | |
| 104 MediaStreamVideoSource::GetVideoSource(video_track.source()); | |
| 105 if (!source) | |
| 106 return nullptr; | |
| 107 | |
| 108 return source->GetCurrentFormat(); | |
| 109 } | |
| 110 | |
| 111 void RequestRefreshFrameFromVideoTrack( | 98 void RequestRefreshFrameFromVideoTrack( |
| 112 const blink::WebMediaStreamTrack& video_track) { | 99 const blink::WebMediaStreamTrack& video_track) { |
| 113 if (video_track.isNull()) | 100 if (video_track.isNull()) |
| 114 return; | 101 return; |
| 115 MediaStreamVideoSource* const source = | 102 MediaStreamVideoSource* const source = |
| 116 MediaStreamVideoSource::GetVideoSource(video_track.source()); | 103 MediaStreamVideoSource::GetVideoSource(video_track.source()); |
| 117 if (source) | 104 if (source) |
| 118 source->RequestRefreshFrame(); | 105 source->RequestRefreshFrame(); |
| 119 } | 106 } |
| 120 | 107 |
| 121 } // namespace content | 108 } // namespace content |
| OLD | NEW |