| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_video_capture_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 case PP_VIDEO_CAPTURE_STATUS_STOPPING: | 100 case PP_VIDEO_CAPTURE_STATUS_STOPPING: |
| 101 default: | 101 default: |
| 102 return PP_ERROR_FAILED; | 102 return PP_ERROR_FAILED; |
| 103 case PP_VIDEO_CAPTURE_STATUS_STARTING: | 103 case PP_VIDEO_CAPTURE_STATUS_STARTING: |
| 104 case PP_VIDEO_CAPTURE_STATUS_STARTED: | 104 case PP_VIDEO_CAPTURE_STATUS_STARTED: |
| 105 case PP_VIDEO_CAPTURE_STATUS_PAUSED: | 105 case PP_VIDEO_CAPTURE_STATUS_PAUSED: |
| 106 break; | 106 break; |
| 107 } | 107 } |
| 108 ReleaseBuffers(); | 108 ReleaseBuffers(); |
| 109 status_ = PP_VIDEO_CAPTURE_STATUS_STOPPING; | 109 status_ = PP_VIDEO_CAPTURE_STATUS_STOPPING; |
| 110 platform_video_capture_->StopCapture(this); | 110 platform_video_capture_->StopCapture(this, false); |
| 111 return PP_OK; | 111 return PP_OK; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void PPB_VideoCapture_Impl::OnStarted(media::VideoCapture* capture) { | 114 void PPB_VideoCapture_Impl::OnStarted(media::VideoCapture* capture) { |
| 115 switch (status_) { | 115 switch (status_) { |
| 116 case PP_VIDEO_CAPTURE_STATUS_STARTING: | 116 case PP_VIDEO_CAPTURE_STATUS_STARTING: |
| 117 case PP_VIDEO_CAPTURE_STATUS_PAUSED: | 117 case PP_VIDEO_CAPTURE_STATUS_PAUSED: |
| 118 break; | 118 break; |
| 119 case PP_VIDEO_CAPTURE_STATUS_STOPPED: | 119 case PP_VIDEO_CAPTURE_STATUS_STOPPED: |
| 120 case PP_VIDEO_CAPTURE_STATUS_STOPPING: | 120 case PP_VIDEO_CAPTURE_STATUS_STOPPING: |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 break; | 222 break; |
| 223 } | 223 } |
| 224 buffers_.push_back(info); | 224 buffers_.push_back(info); |
| 225 } | 225 } |
| 226 | 226 |
| 227 if (buffers_.empty()) { | 227 if (buffers_.empty()) { |
| 228 // We couldn't allocate/map buffers at all. Send an error and stop the | 228 // We couldn't allocate/map buffers at all. Send an error and stop the |
| 229 // capture. | 229 // capture. |
| 230 ppp_videocapture_->OnError(pp_instance(), pp_resource(), PP_ERROR_NOMEMORY); | 230 ppp_videocapture_->OnError(pp_instance(), pp_resource(), PP_ERROR_NOMEMORY); |
| 231 status_ = PP_VIDEO_CAPTURE_STATUS_STOPPING; | 231 status_ = PP_VIDEO_CAPTURE_STATUS_STOPPING; |
| 232 platform_video_capture_->StopCapture(this); | 232 platform_video_capture_->StopCapture(this, false); |
| 233 return; | 233 return; |
| 234 } | 234 } |
| 235 | 235 |
| 236 ppp_videocapture_->OnDeviceInfo(pp_instance(), pp_resource(), &info, | 236 ppp_videocapture_->OnDeviceInfo(pp_instance(), pp_resource(), &info, |
| 237 buffers_.size(), resources.get()); | 237 buffers_.size(), resources.get()); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void PPB_VideoCapture_Impl::ReleaseBuffers() { | 240 void PPB_VideoCapture_Impl::ReleaseBuffers() { |
| 241 ResourceTracker *tracker = ResourceTracker::Get(); | 241 ResourceTracker *tracker = ResourceTracker::Get(); |
| 242 for (size_t i = 0; i < buffers_.size(); ++i) { | 242 for (size_t i = 0; i < buffers_.size(); ++i) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 254 : in_use(false), | 254 : in_use(false), |
| 255 data(NULL), | 255 data(NULL), |
| 256 buffer() { | 256 buffer() { |
| 257 } | 257 } |
| 258 | 258 |
| 259 PPB_VideoCapture_Impl::BufferInfo::~BufferInfo() { | 259 PPB_VideoCapture_Impl::BufferInfo::~BufferInfo() { |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace ppapi | 262 } // namespace ppapi |
| 263 } // namespace webkit | 263 } // namespace webkit |
| OLD | NEW |