OLD | NEW |
---|---|
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 // SampleGrabber filter to a PIN_CATEGORY_STILL of |capture_filter_|. This | 450 // SampleGrabber filter to a PIN_CATEGORY_STILL of |capture_filter_|. This |
451 // way, however, is not widespread and proves too cumbersome, so we just grab | 451 // way, however, is not widespread and proves too cumbersome, so we just grab |
452 // the next captured frame instead. | 452 // the next captured frame instead. |
453 take_photo_callbacks_.push(std::move(callback)); | 453 take_photo_callbacks_.push(std::move(callback)); |
454 } | 454 } |
455 | 455 |
456 // Implements SinkFilterObserver::SinkFilterObserver. | 456 // Implements SinkFilterObserver::SinkFilterObserver. |
457 void VideoCaptureDeviceWin::FrameReceived(const uint8_t* buffer, | 457 void VideoCaptureDeviceWin::FrameReceived(const uint8_t* buffer, |
458 int length, | 458 int length, |
459 base::TimeDelta timestamp) { | 459 base::TimeDelta timestamp) { |
460 if (static_cast<size_t>(length) < capture_format_.ImageAllocationSize()) { | |
461 DLOG(WARNING) << "Media sample buffer with insufficient size."; | |
462 return; | |
mcasas
2016/09/29 20:43:31
With this we will just be ignoring the incoming fr
| |
463 } | |
464 | |
460 if (first_ref_time_.is_null()) | 465 if (first_ref_time_.is_null()) |
461 first_ref_time_ = base::TimeTicks::Now(); | 466 first_ref_time_ = base::TimeTicks::Now(); |
462 | 467 |
463 // There is a chance that the platform does not provide us with the timestamp, | 468 // There is a chance that the platform does not provide us with the timestamp, |
464 // in which case, we use reference time to calculate a timestamp. | 469 // in which case, we use reference time to calculate a timestamp. |
465 if (timestamp == media::kNoTimestamp) | 470 if (timestamp == media::kNoTimestamp) |
466 timestamp = base::TimeTicks::Now() - first_ref_time_; | 471 timestamp = base::TimeTicks::Now() - first_ref_time_; |
467 | 472 |
468 client_->OnIncomingCapturedData(buffer, length, capture_format_, 0, | 473 client_->OnIncomingCapturedData(buffer, length, capture_format_, 0, |
469 base::TimeTicks::Now(), timestamp); | 474 base::TimeTicks::Now(), timestamp); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 void VideoCaptureDeviceWin::SetErrorState( | 594 void VideoCaptureDeviceWin::SetErrorState( |
590 const tracked_objects::Location& from_here, | 595 const tracked_objects::Location& from_here, |
591 const std::string& reason, | 596 const std::string& reason, |
592 HRESULT hr) { | 597 HRESULT hr) { |
593 DCHECK(thread_checker_.CalledOnValidThread()); | 598 DCHECK(thread_checker_.CalledOnValidThread()); |
594 DLOG_IF_FAILED_WITH_HRESULT(reason, hr); | 599 DLOG_IF_FAILED_WITH_HRESULT(reason, hr); |
595 state_ = kError; | 600 state_ = kError; |
596 client_->OnError(from_here, reason); | 601 client_->OnError(from_here, reason); |
597 } | 602 } |
598 } // namespace media | 603 } // namespace media |
OLD | NEW |