| 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 "modules/mediacapturefromelement/HTMLCanvasElementCapture.h" | 5 #include "modules/mediacapturefromelement/HTMLCanvasElementCapture.h" |
| 6 | 6 |
| 7 #include "core/dom/ExceptionCode.h" | 7 #include "core/dom/ExceptionCode.h" |
| 8 #include "core/html/HTMLCanvasElement.h" | 8 #include "core/html/HTMLCanvasElement.h" |
| 9 #include "modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h" | 9 #include "modules/mediacapturefromelement/CanvasCaptureMediaStreamTrack.h" |
| 10 #include "modules/mediastream/MediaStream.h" | 10 #include "modules/mediastream/MediaStream.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 else | 49 else |
| 50 handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size,
kDefaultFrameRate, &track)); | 50 handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size,
kDefaultFrameRate, &track)); |
| 51 | 51 |
| 52 if (!handler) { | 52 if (!handler) { |
| 53 exceptionState.throwDOMException(NotSupportedError, "No CanvasCapture ha
ndler can be created."); | 53 exceptionState.throwDOMException(NotSupportedError, "No CanvasCapture ha
ndler can be created."); |
| 54 return nullptr; | 54 return nullptr; |
| 55 } | 55 } |
| 56 | 56 |
| 57 CanvasCaptureMediaStreamTrack* canvasTrack; | 57 CanvasCaptureMediaStreamTrack* canvasTrack; |
| 58 if (givenFrameRate) | 58 if (givenFrameRate) |
| 59 canvasTrack = CanvasCaptureMediaStreamTrack::create(track, &element, han
dler.release(), frameRate); | 59 canvasTrack = CanvasCaptureMediaStreamTrack::create(track, &element, std
::move(handler), frameRate); |
| 60 else | 60 else |
| 61 canvasTrack = CanvasCaptureMediaStreamTrack::create(track, &element, han
dler.release()); | 61 canvasTrack = CanvasCaptureMediaStreamTrack::create(track, &element, std
::move(handler)); |
| 62 // We want to capture a frame in the beginning. | 62 // We want to capture a frame in the beginning. |
| 63 canvasTrack->requestFrame(); | 63 canvasTrack->requestFrame(); |
| 64 | 64 |
| 65 MediaStreamTrackVector tracks; | 65 MediaStreamTrackVector tracks; |
| 66 tracks.append(canvasTrack); | 66 tracks.append(canvasTrack); |
| 67 return MediaStream::create(element.getExecutionContext(), tracks); | 67 return MediaStream::create(element.getExecutionContext(), tracks); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |