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

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

Issue 1324683004: Win Video Capture: Sending the timestamps provided by the driver to the capture pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fallback to old code path in case no timestamp Created 5 years, 3 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
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/capture/video/win/video_capture_device_win.h" 5 #include "media/capture/video/win/video_capture_device_win.h"
6 6
7 #include <ks.h> 7 #include <ks.h>
8 #include <ksmedia.h> 8 #include <ksmedia.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 441
442 graph_builder_->Disconnect(output_capture_pin_.get()); 442 graph_builder_->Disconnect(output_capture_pin_.get());
443 graph_builder_->Disconnect(input_sink_pin_.get()); 443 graph_builder_->Disconnect(input_sink_pin_.get());
444 444
445 client_.reset(); 445 client_.reset();
446 state_ = kIdle; 446 state_ = kIdle;
447 } 447 }
448 448
449 // Implements SinkFilterObserver::SinkFilterObserver. 449 // Implements SinkFilterObserver::SinkFilterObserver.
450 void VideoCaptureDeviceWin::FrameReceived(const uint8* buffer, int length) { 450 void VideoCaptureDeviceWin::FrameReceived(
451 const uint8* buffer,
452 int length,
453 REFERENCE_TIME raw_timestamp) {
454 base::TimeTicks timestamp;
455 if (raw_timestamp < 0)
456 timestamp = base::TimeTicks::Now();
457 else
458 timestamp += base::TimeDelta::FromMicroseconds(raw_timestamp / 10);
459
451 client_->OnIncomingCapturedData(buffer, length, capture_format_, 0, 460 client_->OnIncomingCapturedData(buffer, length, capture_format_, 0,
452 base::TimeTicks::Now()); 461 timestamp);
453 } 462 }
454 463
455 bool VideoCaptureDeviceWin::CreateCapabilityMap() { 464 bool VideoCaptureDeviceWin::CreateCapabilityMap() {
456 DCHECK(thread_checker_.CalledOnValidThread()); 465 DCHECK(thread_checker_.CalledOnValidThread());
457 ScopedComPtr<IAMStreamConfig> stream_config; 466 ScopedComPtr<IAMStreamConfig> stream_config;
458 HRESULT hr = output_capture_pin_.QueryInterface(stream_config.Receive()); 467 HRESULT hr = output_capture_pin_.QueryInterface(stream_config.Receive());
459 if (FAILED(hr)) { 468 if (FAILED(hr)) {
460 DPLOG(ERROR) << "Failed to get IAMStreamConfig interface from " 469 DPLOG(ERROR) << "Failed to get IAMStreamConfig interface from "
461 "capture device: " << logging::SystemErrorCodeToString(hr); 470 "capture device: " << logging::SystemErrorCodeToString(hr);
462 return false; 471 return false;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 DVLOG(2) << "Anti-flicker setting not supported."; 581 DVLOG(2) << "Anti-flicker setting not supported.";
573 } 582 }
574 } 583 }
575 584
576 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) { 585 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) {
577 DCHECK(thread_checker_.CalledOnValidThread()); 586 DCHECK(thread_checker_.CalledOnValidThread());
578 state_ = kError; 587 state_ = kError;
579 client_->OnError(reason); 588 client_->OnError(reason);
580 } 589 }
581 } // namespace media 590 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698