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

Side by Side Diff: media/capture/video/win/sink_input_pin_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: Restyle 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/sink_input_pin_win.h" 5 #include "media/capture/video/win/sink_input_pin_win.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 // Avoid including strsafe.h via dshow as it will cause build warnings. 9 // Avoid including strsafe.h via dshow as it will cause build warnings.
10 #define NO_DSHOW_STRSAFE 10 #define NO_DSHOW_STRSAFE
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 uint8* buffer = NULL; 175 uint8* buffer = NULL;
176 176
177 if (length <= 0) { 177 if (length <= 0) {
178 DLOG(WARNING) << "Media sample length is 0 or less."; 178 DLOG(WARNING) << "Media sample length is 0 or less.";
179 return S_FALSE; 179 return S_FALSE;
180 } 180 }
181 181
182 if (FAILED(sample->GetPointer(&buffer))) 182 if (FAILED(sample->GetPointer(&buffer)))
183 return S_FALSE; 183 return S_FALSE;
184 184
185 observer_->FrameReceived(buffer, length); 185 REFERENCE_TIME start_time, end_time;
186 base::TimeTicks timestamp;
187 if (SUCCEEDED(sample->GetTime(&start_time, &end_time))) {
188 DCHECK(start_time <= end_time);
189 timestamp += base::TimeDelta::FromMicroseconds(start_time / 10);
190 } else {
191 timestamp = base::TimeTicks::Now();
192 }
193
194
195 observer_->FrameReceived(buffer, length, timestamp);
186 return S_OK; 196 return S_OK;
187 } 197 }
188 198
189 SinkInputPin::~SinkInputPin() { 199 SinkInputPin::~SinkInputPin() {
190 } 200 }
191 201
192 } // namespace media 202 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/win/sink_filter_observer_win.h ('k') | media/capture/video/win/video_capture_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698