This changes the following module directories:
* webrtc/modules/audio_conference_mixer/interface
* webrtc/modules/interface
* webrtc/modules/media_file/interface
* webrtc/modules/rtp_rtcp/interface
* webrtc/modules/utility/interface
To avoid breaking downstream, I followed this recipe:
1. Copy the interface dir to a new sibling directory: include
2. Update the header guards in the include directory to match the style guide.
3. Update the header guards in the interface directory to match the ones in include. This is required to avoid getting redefinitions in the not-yet-updated downstream code.
4. Add a pragma warning in the header files in the interface dir. Example:
#pragma message("WARNING: webrtc/modules/interface is DEPRECATED; "
"use webrtc/modules/include")
5. Search for all source references to webrtc/modules/interface and update them to webrtc/modules/include (*.c*,*.h,*.mm,*.S)
6. Update all GYP+GN files. This required manual inspection since many subdirectories of webrtc/modules referenced the interface dir using ../interface etc(*.gyp*,*.gn*)
BUG=5095
TESTED=Passing compile-trybots with --clobber flag:
git cl try --clobber --bot=win_compile_rel --bot=linux_compile_rel --bot=android_compile_rel --bot=mac_compile_rel --bot=ios_rel -m tryserver.webrtc
R=stefan@webrtc.org, tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1417683006 .
Cr-Commit-Position: refs/heads/master@{#10500}
96 lines
3.0 KiB
C++
96 lines
3.0 KiB
C++
/*
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "webrtc/common_video/video_render_frames.h"
|
|
|
|
#include <assert.h>
|
|
|
|
#include "webrtc/modules/include/module_common_types.h"
|
|
#include "webrtc/system_wrappers/include/tick_util.h"
|
|
#include "webrtc/system_wrappers/include/trace.h"
|
|
|
|
namespace webrtc {
|
|
|
|
const uint32_t KEventMaxWaitTimeMs = 200;
|
|
const uint32_t kMinRenderDelayMs = 10;
|
|
const uint32_t kMaxRenderDelayMs= 500;
|
|
|
|
VideoRenderFrames::VideoRenderFrames()
|
|
: render_delay_ms_(10) {
|
|
}
|
|
|
|
int32_t VideoRenderFrames::AddFrame(const VideoFrame& new_frame) {
|
|
const int64_t time_now = TickTime::MillisecondTimestamp();
|
|
|
|
// Drop old frames only when there are other frames in the queue, otherwise, a
|
|
// really slow system never renders any frames.
|
|
if (!incoming_frames_.empty() &&
|
|
new_frame.render_time_ms() + KOldRenderTimestampMS < time_now) {
|
|
WEBRTC_TRACE(kTraceWarning,
|
|
kTraceVideoRenderer,
|
|
-1,
|
|
"%s: too old frame, timestamp=%u.",
|
|
__FUNCTION__,
|
|
new_frame.timestamp());
|
|
return -1;
|
|
}
|
|
|
|
if (new_frame.render_time_ms() > time_now + KFutureRenderTimestampMS) {
|
|
WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer, -1,
|
|
"%s: frame too long into the future, timestamp=%u.",
|
|
__FUNCTION__, new_frame.timestamp());
|
|
return -1;
|
|
}
|
|
|
|
incoming_frames_.push_back(new_frame);
|
|
return static_cast<int32_t>(incoming_frames_.size());
|
|
}
|
|
|
|
VideoFrame VideoRenderFrames::FrameToRender() {
|
|
VideoFrame render_frame;
|
|
// Get the newest frame that can be released for rendering.
|
|
while (!incoming_frames_.empty() && TimeToNextFrameRelease() <= 0) {
|
|
render_frame = incoming_frames_.front();
|
|
incoming_frames_.pop_front();
|
|
}
|
|
return render_frame;
|
|
}
|
|
|
|
int32_t VideoRenderFrames::ReleaseAllFrames() {
|
|
incoming_frames_.clear();
|
|
return 0;
|
|
}
|
|
|
|
uint32_t VideoRenderFrames::TimeToNextFrameRelease() {
|
|
if (incoming_frames_.empty()) {
|
|
return KEventMaxWaitTimeMs;
|
|
}
|
|
const int64_t time_to_release = incoming_frames_.front().render_time_ms() -
|
|
render_delay_ms_ -
|
|
TickTime::MillisecondTimestamp();
|
|
return time_to_release < 0 ? 0u : static_cast<uint32_t>(time_to_release);
|
|
}
|
|
|
|
int32_t VideoRenderFrames::SetRenderDelay(
|
|
const uint32_t render_delay) {
|
|
if (render_delay < kMinRenderDelayMs ||
|
|
render_delay > kMaxRenderDelayMs) {
|
|
WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer,
|
|
-1, "%s(%d): Invalid argument.", __FUNCTION__,
|
|
render_delay);
|
|
return -1;
|
|
}
|
|
|
|
render_delay_ms_ = render_delay;
|
|
return 0;
|
|
}
|
|
|
|
} // namespace webrtc
|