Make VideoReceiveStream not inherit from I420FrameCallback.

There's no need for it as the current implementation only exists as a middle layer between the decoder and the eventual callback.

R=mflodman@webrtc.org, pbos@webrtc.org

Review URL: https://codereview.webrtc.org/2039053002 .

Cr-Commit-Position: refs/heads/master@{#13101}
This commit is contained in:
Tommi 2016-06-10 17:38:17 +02:00
parent bdce06e460
commit bd3380ff7e
4 changed files with 11 additions and 16 deletions

View File

@ -181,7 +181,7 @@ VideoReceiveStream::VideoReceiveStream(
rtp_stream_receiver_.IsFecEnabled(),
&stats_proxy_,
&incoming_video_stream_,
this),
config.pre_render_callback),
vie_sync_(&video_receiver_) {
LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
@ -290,17 +290,9 @@ VideoReceiveStream::Stats VideoReceiveStream::GetStats() const {
return stats_proxy_.GetStats();
}
void VideoReceiveStream::FrameCallback(VideoFrame* video_frame) {
void VideoReceiveStream::OnFrame(const VideoFrame& video_frame) {
stats_proxy_.OnDecodedFrame();
// Post processing is not supported if the frame is backed by a texture.
if (!video_frame->video_frame_buffer()->native_handle()) {
if (config_.pre_render_callback)
config_.pre_render_callback->FrameCallback(video_frame);
}
}
void VideoReceiveStream::OnFrame(const VideoFrame& video_frame) {
int64_t sync_offset_ms;
if (vie_sync_.GetStreamSyncOffsetInMs(video_frame, &sync_offset_ms))
stats_proxy_.OnSyncOffsetUpdated(sync_offset_ms);

View File

@ -38,7 +38,6 @@ class VieRemb;
namespace internal {
class VideoReceiveStream : public webrtc::VideoReceiveStream,
public I420FrameCallback,
public rtc::VideoSinkInterface<VideoFrame>,
public EncodedImageCallback,
public NackSender,
@ -65,9 +64,6 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
webrtc::VideoReceiveStream::Stats GetStats() const override;
// Overrides I420FrameCallback.
void FrameCallback(VideoFrame* video_frame) override;
// Overrides rtc::VideoSinkInterface<VideoFrame>.
void OnFrame(const VideoFrame& video_frame) override;

View File

@ -77,8 +77,12 @@ VideoStreamDecoder::~VideoStreamDecoder() {}
// thread may have held the lock when calling VideoDecoder::Decode, Reset, or
// Release. Acquiring the same lock in the path of decode callback can deadlock.
int32_t VideoStreamDecoder::FrameToRender(VideoFrame& video_frame) { // NOLINT
if (pre_render_callback_)
pre_render_callback_->FrameCallback(&video_frame);
if (pre_render_callback_) {
// Post processing is not supported if the frame is backed by a texture.
if (!video_frame.video_frame_buffer()->native_handle()) {
pre_render_callback_->FrameCallback(&video_frame);
}
}
incoming_video_stream_->OnFrame(video_frame);
return 0;

View File

@ -168,6 +168,9 @@ class VideoReceiveStream {
// Called for each decoded frame. E.g. used when adding effects to the
// decoded
// stream. 'nullptr' disables the callback.
// TODO(tommi): This seems to be only used by a test or two. Consider
// removing it (and use an appropriate alternative in the tests) as well
// as the associated code in VideoStreamDecoder.
I420FrameCallback* pre_render_callback = nullptr;
// Target delay in milliseconds. A positive value indicates this stream is