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

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

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return false; 181 return false;
182 } 182 }
183 183
184 media_type->bFixedSizeSamples = TRUE; 184 media_type->bFixedSizeSamples = TRUE;
185 media_type->lSampleSize = pvi->bmiHeader.biSizeImage; 185 media_type->lSampleSize = pvi->bmiHeader.biSizeImage;
186 return true; 186 return true;
187 } 187 }
188 188
189 HRESULT SinkInputPin::Receive(IMediaSample* sample) { 189 HRESULT SinkInputPin::Receive(IMediaSample* sample) {
190 const int length = sample->GetActualDataLength(); 190 const int length = sample->GetActualDataLength();
191 uint8* buffer = NULL; 191 uint8_t* buffer = NULL;
192 192
193 if (length <= 0) { 193 if (length <= 0) {
194 DLOG(WARNING) << "Media sample length is 0 or less."; 194 DLOG(WARNING) << "Media sample length is 0 or less.";
195 return S_FALSE; 195 return S_FALSE;
196 } 196 }
197 197
198 if (FAILED(sample->GetPointer(&buffer))) 198 if (FAILED(sample->GetPointer(&buffer)))
199 return S_FALSE; 199 return S_FALSE;
200 200
201 REFERENCE_TIME start_time, end_time; 201 REFERENCE_TIME start_time, end_time;
202 base::TimeTicks timestamp; 202 base::TimeTicks timestamp;
203 if (SUCCEEDED(sample->GetTime(&start_time, &end_time))) { 203 if (SUCCEEDED(sample->GetTime(&start_time, &end_time))) {
204 DCHECK(start_time <= end_time); 204 DCHECK(start_time <= end_time);
205 timestamp += base::TimeDelta::FromMicroseconds(start_time / 10); 205 timestamp += base::TimeDelta::FromMicroseconds(start_time / 10);
206 } else { 206 } else {
207 timestamp = base::TimeTicks::Now(); 207 timestamp = base::TimeTicks::Now();
208 } 208 }
209 209
210 210
211 observer_->FrameReceived(buffer, length, timestamp); 211 observer_->FrameReceived(buffer, length, timestamp);
212 return S_OK; 212 return S_OK;
213 } 213 }
214 214
215 SinkInputPin::~SinkInputPin() { 215 SinkInputPin::~SinkInputPin() {
216 } 216 }
217 217
218 } // namespace media 218 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698