Delete unused methods SetStartImage and SetTimeoutImage.
Declared in webrtc::VideoRender, implemented in IncomingVideoStream. This cl also eliminates some of the few uses of webrtc::VideoFrame::CopyFrame. BUG=webrtc:5682 Review URL: https://codereview.webrtc.org/1885323002 Cr-Commit-Position: refs/heads/master@{#12427}
This commit is contained in:
parent
ba7dc723b0
commit
cc23b7c1ea
@ -57,11 +57,6 @@ class IncomingVideoStream : public VideoRenderCallback {
|
||||
uint32_t StreamId() const;
|
||||
uint32_t IncomingRate() const;
|
||||
|
||||
void SetStartImage(const VideoFrame& video_frame);
|
||||
|
||||
void SetTimeoutImage(const VideoFrame& video_frame,
|
||||
const uint32_t timeout);
|
||||
|
||||
int32_t SetExpectedRenderDelay(int32_t delay_ms);
|
||||
|
||||
protected:
|
||||
@ -96,11 +91,6 @@ class IncomingVideoStream : public VideoRenderCallback {
|
||||
uint32_t incoming_rate_ GUARDED_BY(stream_critsect_);
|
||||
int64_t last_rate_calculation_time_ms_ GUARDED_BY(stream_critsect_);
|
||||
uint16_t num_frames_since_last_calculation_ GUARDED_BY(stream_critsect_);
|
||||
int64_t last_render_time_ms_ GUARDED_BY(thread_critsect_);
|
||||
VideoFrame temp_frame_ GUARDED_BY(thread_critsect_);
|
||||
VideoFrame start_image_ GUARDED_BY(thread_critsect_);
|
||||
VideoFrame timeout_image_ GUARDED_BY(thread_critsect_);
|
||||
uint32_t timeout_time_ GUARDED_BY(thread_critsect_);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -43,12 +43,7 @@ IncomingVideoStream::IncomingVideoStream(uint32_t stream_id,
|
||||
render_buffers_(new VideoRenderFrames()),
|
||||
incoming_rate_(0),
|
||||
last_rate_calculation_time_ms_(0),
|
||||
num_frames_since_last_calculation_(0),
|
||||
last_render_time_ms_(0),
|
||||
temp_frame_(),
|
||||
start_image_(),
|
||||
timeout_image_(),
|
||||
timeout_time_() {}
|
||||
num_frames_since_last_calculation_(0) {}
|
||||
|
||||
IncomingVideoStream::~IncomingVideoStream() {
|
||||
Stop();
|
||||
@ -89,18 +84,6 @@ int32_t IncomingVideoStream::RenderFrame(const uint32_t stream_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IncomingVideoStream::SetStartImage(const VideoFrame& video_frame) {
|
||||
rtc::CritScope csS(&thread_critsect_);
|
||||
start_image_.CopyFrame(video_frame);
|
||||
}
|
||||
|
||||
void IncomingVideoStream::SetTimeoutImage(const VideoFrame& video_frame,
|
||||
const uint32_t timeout) {
|
||||
rtc::CritScope csS(&thread_critsect_);
|
||||
timeout_time_ = timeout;
|
||||
timeout_image_.CopyFrame(video_frame);
|
||||
}
|
||||
|
||||
void IncomingVideoStream::SetRenderCallback(
|
||||
VideoRenderCallback* render_callback) {
|
||||
rtc::CritScope cs(&thread_critsect_);
|
||||
@ -226,20 +209,6 @@ bool IncomingVideoStream::IncomingVideoStreamProcess() {
|
||||
void IncomingVideoStream::DeliverFrame(const VideoFrame& video_frame) {
|
||||
rtc::CritScope cs(&thread_critsect_);
|
||||
if (video_frame.IsZeroSize()) {
|
||||
if (render_callback_) {
|
||||
if (last_render_time_ms_ == 0 && !start_image_.IsZeroSize()) {
|
||||
// We have not rendered anything and have a start image.
|
||||
temp_frame_.CopyFrame(start_image_);
|
||||
render_callback_->RenderFrame(stream_id_, temp_frame_);
|
||||
} else if (!timeout_image_.IsZeroSize() &&
|
||||
last_render_time_ms_ + timeout_time_ <
|
||||
TickTime::MillisecondTimestamp()) {
|
||||
// Render a timeout image.
|
||||
temp_frame_.CopyFrame(timeout_image_);
|
||||
render_callback_->RenderFrame(stream_id_, temp_frame_);
|
||||
}
|
||||
}
|
||||
|
||||
// No frame.
|
||||
return;
|
||||
}
|
||||
@ -250,9 +219,6 @@ void IncomingVideoStream::DeliverFrame(const VideoFrame& video_frame) {
|
||||
} else if (render_callback_) {
|
||||
render_callback_->RenderFrame(stream_id_, video_frame);
|
||||
}
|
||||
|
||||
// We're done with this frame.
|
||||
last_render_time_ms_ = video_frame.render_time_ms();
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -250,19 +250,6 @@ public:
|
||||
const uint32_t backgroundColorRef,
|
||||
const float left, const float top,
|
||||
const float right, const float bottom) = 0;
|
||||
|
||||
/*
|
||||
* Set a start image. The image is rendered before the first image has been delivered
|
||||
*/
|
||||
virtual int32_t SetStartImage(const uint32_t streamId,
|
||||
const VideoFrame& videoFrame) = 0;
|
||||
|
||||
/*
|
||||
* Set a timout image. The image is rendered if no videoframe has been delivered
|
||||
*/
|
||||
virtual int32_t SetTimeoutImage(const uint32_t streamId,
|
||||
const VideoFrame& videoFrame,
|
||||
const uint32_t timeout) = 0;
|
||||
};
|
||||
} // namespace webrtc
|
||||
#endif // WEBRTC_MODULES_VIDEO_RENDER_VIDEO_RENDER_H_
|
||||
|
||||
@ -547,56 +547,4 @@ int32_t ModuleVideoRenderImpl::ConfigureRenderer(
|
||||
bottom);
|
||||
}
|
||||
|
||||
int32_t ModuleVideoRenderImpl::SetStartImage(const uint32_t streamId,
|
||||
const VideoFrame& videoFrame) {
|
||||
CriticalSectionScoped cs(&_moduleCrit);
|
||||
|
||||
if (!_ptrRenderer)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
|
||||
"%s: No renderer", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
IncomingVideoStreamMap::const_iterator item =
|
||||
_streamRenderMap.find(streamId);
|
||||
if (item == _streamRenderMap.end())
|
||||
{
|
||||
// This stream doesn't exist
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
|
||||
"%s: stream doesn't exist", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
assert (item->second != NULL);
|
||||
item->second->SetStartImage(videoFrame);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int32_t ModuleVideoRenderImpl::SetTimeoutImage(const uint32_t streamId,
|
||||
const VideoFrame& videoFrame,
|
||||
const uint32_t timeout) {
|
||||
CriticalSectionScoped cs(&_moduleCrit);
|
||||
|
||||
if (!_ptrRenderer)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
|
||||
"%s: No renderer", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
IncomingVideoStreamMap::const_iterator item =
|
||||
_streamRenderMap.find(streamId);
|
||||
if (item == _streamRenderMap.end())
|
||||
{
|
||||
// This stream doesn't exist
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
|
||||
"%s: stream doesn't exist", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
assert(item->second != NULL);
|
||||
item->second->SetTimeoutImage(videoFrame, timeout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -192,13 +192,6 @@ public:
|
||||
const float left, const float top,
|
||||
const float right, const float bottom);
|
||||
|
||||
virtual int32_t SetStartImage(const uint32_t streamId,
|
||||
const VideoFrame& videoFrame);
|
||||
|
||||
virtual int32_t SetTimeoutImage(const uint32_t streamId,
|
||||
const VideoFrame& videoFrame,
|
||||
const uint32_t timeout);
|
||||
|
||||
private:
|
||||
int32_t _id;
|
||||
CriticalSectionWrapper& _moduleCrit;
|
||||
|
||||
@ -770,56 +770,4 @@ int32_t ModuleVideoRenderImpl::ConfigureRenderer(
|
||||
bottom);
|
||||
}
|
||||
|
||||
int32_t ModuleVideoRenderImpl::SetStartImage(const uint32_t streamId,
|
||||
const VideoFrame& videoFrame) {
|
||||
CriticalSectionScoped cs(&_moduleCrit);
|
||||
|
||||
if (!_ptrRenderer)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
|
||||
"%s: No renderer", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
IncomingVideoStreamMap::const_iterator item =
|
||||
_streamRenderMap.find(streamId);
|
||||
if (item == _streamRenderMap.end())
|
||||
{
|
||||
// This stream doesn't exist
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
|
||||
"%s: stream doesn't exist", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
assert (item->second != NULL);
|
||||
item->second->SetStartImage(videoFrame);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int32_t ModuleVideoRenderImpl::SetTimeoutImage(const uint32_t streamId,
|
||||
const VideoFrame& videoFrame,
|
||||
const uint32_t timeout) {
|
||||
CriticalSectionScoped cs(&_moduleCrit);
|
||||
|
||||
if (!_ptrRenderer)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
|
||||
"%s: No renderer", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
IncomingVideoStreamMap::const_iterator item =
|
||||
_streamRenderMap.find(streamId);
|
||||
if (item == _streamRenderMap.end())
|
||||
{
|
||||
// This stream doesn't exist
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
|
||||
"%s: stream doesn't exist", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
assert(item->second != NULL);
|
||||
item->second->SetTimeoutImage(videoFrame, timeout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user