Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: media/video/capture/win/video_capture_device_mf_win.cc

Issue 83793004: Implement IPCs and VideoCapture::Client interfaces for texture capture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 5744a8bbb Nits. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/video/capture/win/video_capture_device_mf_win.h" 5 #include "media/video/capture/win/video_capture_device_mf_win.h"
6 6
7 #include <mfapi.h> 7 #include <mfapi.h>
8 #include <mferror.h> 8 #include <mferror.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 STDMETHOD_(ULONG, Release)() { 200 STDMETHOD_(ULONG, Release)() {
201 base::RefCountedThreadSafe<MFReaderCallback>::Release(); 201 base::RefCountedThreadSafe<MFReaderCallback>::Release();
202 return 1U; 202 return 1U;
203 } 203 }
204 204
205 STDMETHOD(OnReadSample)(HRESULT status, DWORD stream_index, 205 STDMETHOD(OnReadSample)(HRESULT status, DWORD stream_index,
206 DWORD stream_flags, LONGLONG time_stamp, IMFSample* sample) { 206 DWORD stream_flags, LONGLONG time_stamp, IMFSample* sample) {
207 base::TimeTicks stamp(base::TimeTicks::Now()); 207 base::TimeTicks stamp(base::TimeTicks::Now());
208 if (!sample) { 208 if (!sample) {
209 observer_->OnIncomingCapturedFrame(NULL, 0, stamp, 0); 209 observer_->OnIncomingCapturedFrame(NULL, 0, 0, stamp);
210 return S_OK; 210 return S_OK;
211 } 211 }
212 212
213 DWORD count = 0; 213 DWORD count = 0;
214 sample->GetBufferCount(&count); 214 sample->GetBufferCount(&count);
215 215
216 for (DWORD i = 0; i < count; ++i) { 216 for (DWORD i = 0; i < count; ++i) {
217 ScopedComPtr<IMFMediaBuffer> buffer; 217 ScopedComPtr<IMFMediaBuffer> buffer;
218 sample->GetBufferByIndex(i, buffer.Receive()); 218 sample->GetBufferByIndex(i, buffer.Receive());
219 if (buffer) { 219 if (buffer) {
220 DWORD length = 0, max_length = 0; 220 DWORD length = 0, max_length = 0;
221 BYTE* data = NULL; 221 BYTE* data = NULL;
222 buffer->Lock(&data, &max_length, &length); 222 buffer->Lock(&data, &max_length, &length);
223 observer_->OnIncomingCapturedFrame(data, length, stamp, 0); 223 observer_->OnIncomingCapturedFrame(data, length, 0, stamp);
224 buffer->Unlock(); 224 buffer->Unlock();
225 } 225 }
226 } 226 }
227 return S_OK; 227 return S_OK;
228 } 228 }
229 229
230 STDMETHOD(OnFlush)(DWORD stream_index) { 230 STDMETHOD(OnFlush)(DWORD stream_index) {
231 if (wait_event_) { 231 if (wait_event_) {
232 wait_event_->Signal(); 232 wait_event_->Signal();
233 wait_event_ = NULL; 233 wait_event_ = NULL;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 431 }
432 } 432 }
433 433
434 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { 434 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) {
435 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; 435 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr;
436 if (client_.get()) 436 if (client_.get())
437 client_->OnError(); 437 client_->OnError();
438 } 438 }
439 439
440 } // namespace media 440 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698