* Update libjingle to 50389769.
* Together with "Add texture support for i420 video frame." from wuchengli@chromium.org. https://webrtc-codereview.appspot.com/1413004 RISK=P1 TESTED=try bots R=fischman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1967004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4489 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "webrtc/common_video/interface/texture_video_frame.h"
|
||||
#include "webrtc/modules/interface/module_common_types.h"
|
||||
#include "webrtc/system_wrappers/interface/tick_util.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
@ -47,6 +48,16 @@ int32_t VideoRenderFrames::AddFrame(I420VideoFrame* new_frame) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (new_frame->native_handle() != NULL) {
|
||||
incoming_frames_.PushBack(new TextureVideoFrame(
|
||||
static_cast<NativeHandle*>(new_frame->native_handle()),
|
||||
new_frame->width(),
|
||||
new_frame->height(),
|
||||
new_frame->timestamp(),
|
||||
new_frame->render_time_ms()));
|
||||
return incoming_frames_.GetSize();
|
||||
}
|
||||
|
||||
// Get an empty frame
|
||||
I420VideoFrame* frame_to_add = NULL;
|
||||
if (!empty_frames_.Empty()) {
|
||||
@ -103,10 +114,7 @@ I420VideoFrame* VideoRenderFrames::FrameToRender() {
|
||||
// This is the oldest one so far and it's OK to render.
|
||||
if (render_frame) {
|
||||
// This one is older than the newly found frame, remove this one.
|
||||
render_frame->ResetSize();
|
||||
render_frame->set_timestamp(0);
|
||||
render_frame->set_render_time_ms(0);
|
||||
empty_frames_.PushFront(render_frame);
|
||||
ReturnFrame(render_frame);
|
||||
}
|
||||
render_frame = oldest_frame_in_list;
|
||||
incoming_frames_.Erase(item);
|
||||
@ -122,10 +130,15 @@ I420VideoFrame* VideoRenderFrames::FrameToRender() {
|
||||
}
|
||||
|
||||
int32_t VideoRenderFrames::ReturnFrame(I420VideoFrame* old_frame) {
|
||||
old_frame->ResetSize();
|
||||
old_frame->set_timestamp(0);
|
||||
old_frame->set_render_time_ms(0);
|
||||
empty_frames_.PushBack(old_frame);
|
||||
// No need to reuse texture frames because they do not allocate memory.
|
||||
if (old_frame->native_handle() == NULL) {
|
||||
old_frame->ResetSize();
|
||||
old_frame->set_timestamp(0);
|
||||
old_frame->set_render_time_ms(0);
|
||||
empty_frames_.PushBack(old_frame);
|
||||
} else {
|
||||
delete old_frame;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user