Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 rtc::CritScope lock(&crit_); | 77 rtc::CritScope lock(&crit_); |
| 78 if (incoming_frame.ntp_time_ms() <= last_captured_timestamp_) { | 78 if (incoming_frame.ntp_time_ms() <= last_captured_timestamp_) { |
| 79 // We don't allow the same capture time for two frames, drop this one. | 79 // We don't allow the same capture time for two frames, drop this one. |
| 80 LOG(LS_WARNING) << "Same/old NTP timestamp (" | 80 LOG(LS_WARNING) << "Same/old NTP timestamp (" |
| 81 << incoming_frame.ntp_time_ms() | 81 << incoming_frame.ntp_time_ms() |
| 82 << " <= " << last_captured_timestamp_ | 82 << " <= " << last_captured_timestamp_ |
| 83 << ") for incoming frame. Dropping."; | 83 << ") for incoming frame. Dropping."; |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 | 86 |
| 87 captured_frame_.ShallowCopy(incoming_frame); | 87 captured_frame_.reset(new VideoFrame); |
|
pbos-webrtc
2016/04/13 12:31:52
Consider getting rid of this heap allocation.
nisse-webrtc
2016/04/13 12:45:26
It's kind-of tricky.
1. I aim to make sure that
| |
| 88 captured_frame_->ShallowCopy(incoming_frame); | |
| 88 last_captured_timestamp_ = incoming_frame.ntp_time_ms(); | 89 last_captured_timestamp_ = incoming_frame.ntp_time_ms(); |
| 89 | 90 |
| 90 overuse_detector_->FrameCaptured(captured_frame_); | 91 overuse_detector_->FrameCaptured(*captured_frame_); |
| 91 | 92 |
| 92 TRACE_EVENT_ASYNC_BEGIN1("webrtc", "Video", video_frame.render_time_ms(), | 93 TRACE_EVENT_ASYNC_BEGIN1("webrtc", "Video", video_frame.render_time_ms(), |
| 93 "render_time", video_frame.render_time_ms()); | 94 "render_time", video_frame.render_time_ms()); |
| 94 | 95 |
| 95 capture_event_->Set(); | 96 capture_event_->Set(); |
| 96 } | 97 } |
| 97 | 98 |
| 98 bool VideoCaptureInput::GetVideoFrame(VideoFrame* video_frame) { | 99 bool VideoCaptureInput::GetVideoFrame(VideoFrame* video_frame) { |
| 99 rtc::CritScope lock(&crit_); | 100 rtc::CritScope lock(&crit_); |
| 100 if (captured_frame_.IsZeroSize()) | 101 if (!captured_frame_) |
| 101 return false; | 102 return false; |
| 102 | 103 |
| 103 *video_frame = captured_frame_; | 104 *video_frame = *captured_frame_; |
| 104 captured_frame_.Reset(); | 105 captured_frame_.reset(); |
| 105 return true; | 106 return true; |
| 106 } | 107 } |
| 107 | 108 |
| 108 } // namespace internal | 109 } // namespace internal |
| 109 } // namespace webrtc | 110 } // namespace webrtc |
| OLD | NEW |