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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer, -1, | 46 WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer, -1, |
47 "%s: frame too long into the future, timestamp=%u.", | 47 "%s: frame too long into the future, timestamp=%u.", |
48 __FUNCTION__, new_frame.timestamp()); | 48 __FUNCTION__, new_frame.timestamp()); |
49 return -1; | 49 return -1; |
50 } | 50 } |
51 | 51 |
52 incoming_frames_.push_back(new_frame); | 52 incoming_frames_.push_back(new_frame); |
53 return static_cast<int32_t>(incoming_frames_.size()); | 53 return static_cast<int32_t>(incoming_frames_.size()); |
54 } | 54 } |
55 | 55 |
56 VideoFrame VideoRenderFrames::FrameToRender() { | 56 rtc::Optional<VideoFrame> VideoRenderFrames::FrameToRender() { |
57 VideoFrame render_frame; | 57 rtc::Optional<VideoFrame> render_frame; |
58 // Get the newest frame that can be released for rendering. | 58 // Get the newest frame that can be released for rendering. |
59 while (!incoming_frames_.empty() && TimeToNextFrameRelease() <= 0) { | 59 while (!incoming_frames_.empty() && TimeToNextFrameRelease() <= 0) { |
60 render_frame = incoming_frames_.front(); | 60 render_frame = rtc::Optional<VideoFrame>(incoming_frames_.front()); |
61 incoming_frames_.pop_front(); | 61 incoming_frames_.pop_front(); |
62 } | 62 } |
63 return render_frame; | 63 return render_frame; |
64 } | 64 } |
65 | 65 |
66 int32_t VideoRenderFrames::ReleaseAllFrames() { | 66 int32_t VideoRenderFrames::ReleaseAllFrames() { |
67 incoming_frames_.clear(); | 67 incoming_frames_.clear(); |
68 return 0; | 68 return 0; |
69 } | 69 } |
70 | 70 |
(...skipping 15 matching lines...) Expand all Loading... |
86 -1, "%s(%d): Invalid argument.", __FUNCTION__, | 86 -1, "%s(%d): Invalid argument.", __FUNCTION__, |
87 render_delay); | 87 render_delay); |
88 return -1; | 88 return -1; |
89 } | 89 } |
90 | 90 |
91 render_delay_ms_ = render_delay; | 91 render_delay_ms_ = render_delay; |
92 return 0; | 92 return 0; |
93 } | 93 } |
94 | 94 |
95 } // namespace webrtc | 95 } // namespace webrtc |
OLD | NEW |