* Add the time_stamp as one parameter to the ViE ExternalRenderer interface.

* Fix one issue in webrtcvideoengine where we should remove the renderer before adding a new one.
Review URL: http://webrtc-codereview.appspot.com/137011

git-svn-id: http://webrtc.googlecode.com/svn/trunk@501 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org 2011-08-31 22:14:44 +00:00
parent ebb2744337
commit b15bfd32d7
4 changed files with 11 additions and 5 deletions

View File

@ -40,7 +40,8 @@ public:
unsigned int numberOfStreams) = 0;
// This method is called when a new frame should be rendered.
virtual int DeliverFrame(unsigned char* buffer, int bufferSize) = 0;
virtual int DeliverFrame(unsigned char* buffer, int bufferSize,
unsigned int time_stamp) = 0;
protected:
virtual ~ExternalRenderer() {}

View File

@ -236,7 +236,9 @@ WebRtc_Word32 ViEExternalRendererImpl::RenderFrame(const WebRtc_UWord32 streamId
if(pConvertedFrame)
{
_externalRenderer->DeliverFrame(pConvertedFrame->Buffer(), pConvertedFrame->Length());
_externalRenderer->DeliverFrame(pConvertedFrame->Buffer(),
pConvertedFrame->Length(),
videoFrame.TimeStamp());
}
return 0;
}

View File

@ -55,7 +55,8 @@ public:
return 0;
}
virtual int DeliverFrame(unsigned char* buffer, int bufferSize)
virtual int DeliverFrame(unsigned char* buffer, int bufferSize,
unsigned int time_stamp)
{
if (bufferSize != _width * _height * 3 / 2)
{

View File

@ -61,7 +61,8 @@ class WebRtcRenderAdapter : public webrtc::ExternalRenderer {
return renderer_->SetSize(width_, height_, 0) ? 0 : -1;
}
virtual int DeliverFrame(unsigned char* buffer, int buffer_size) {
virtual int DeliverFrame(unsigned char* buffer, int buffer_size,
unsigned int time_stamp) {
if (renderer_ == NULL) {
return 0;
}
@ -70,7 +71,7 @@ class WebRtcRenderAdapter : public webrtc::ExternalRenderer {
// ViE expects the frame will be rendered ASAP. However, the libjingle
// renderer may have its own internal delays. Can you disable the buffering
// inside ViE and surface the timing information to this callback?
video_frame.Attach(buffer, buffer_size, width_, height_, 0, 0);
video_frame.Attach(buffer, buffer_size, width_, height_, 0, time_stamp);
int ret = renderer_->RenderFrame(&video_frame) ? 0 : -1;
uint8* buffer_temp;
size_t buffer_size_temp;
@ -392,6 +393,7 @@ bool WebRtcVideoEngine::SetLocalRenderer(VideoRenderer* renderer) {
if (local_renderer_.get()) {
// If the renderer already set, stop it first
vie_wrapper_->render()->StopRender(capture_id_);
vie_wrapper_->render()->RemoveRenderer(capture_id_);
}
local_renderer_.reset(new WebRtcRenderAdapter(renderer));