Switching to I420VideoFrame
Review URL: https://webrtc-codereview.appspot.com/922004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2983 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -40,13 +40,13 @@ void VCMDecodedFrameCallback::SetUserReceiveCallback(
|
||||
_receiveCallback = receiveCallback;
|
||||
}
|
||||
|
||||
WebRtc_Word32 VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage)
|
||||
WebRtc_Word32 VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage)
|
||||
{
|
||||
// TODO(holmer): We should improve this so that we can handle multiple
|
||||
// callbacks from one call to Decode().
|
||||
CriticalSectionScoped cs(_critSect);
|
||||
VCMFrameInformation* frameInfo = static_cast<VCMFrameInformation*>(
|
||||
_timestampMap.Pop(decodedImage.TimeStamp()));
|
||||
_timestampMap.Pop(decodedImage.timestamp()));
|
||||
if (frameInfo == NULL)
|
||||
{
|
||||
// The map should never be empty or full if this callback is called.
|
||||
@ -54,14 +54,14 @@ WebRtc_Word32 VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage)
|
||||
}
|
||||
|
||||
_timing.StopDecodeTimer(
|
||||
decodedImage.TimeStamp(),
|
||||
decodedImage.timestamp(),
|
||||
frameInfo->decodeStartTimeMs,
|
||||
_clock->MillisecondTimestamp());
|
||||
|
||||
if (_receiveCallback != NULL)
|
||||
{
|
||||
_frame.SwapFrame(decodedImage);
|
||||
_frame.SetRenderTime(frameInfo->renderTimeMs);
|
||||
_frame.SwapFrame(&decodedImage);
|
||||
_frame.set_render_time_ms(frameInfo->renderTimeMs);
|
||||
WebRtc_Word32 callbackReturn = _receiveCallback->FrameToRender(_frame);
|
||||
if (callbackReturn < 0)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
virtual ~VCMDecodedFrameCallback();
|
||||
void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback);
|
||||
|
||||
virtual WebRtc_Word32 Decoded(VideoFrame& decodedImage);
|
||||
virtual WebRtc_Word32 Decoded(I420VideoFrame& decodedImage);
|
||||
virtual WebRtc_Word32 ReceivedDecodedReferenceFrame(const WebRtc_UWord64 pictureId);
|
||||
virtual WebRtc_Word32 ReceivedDecodedFrame(const WebRtc_UWord64 pictureId);
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
private:
|
||||
CriticalSectionWrapper* _critSect;
|
||||
TickTimeBase* _clock;
|
||||
VideoFrame _frame;
|
||||
I420VideoFrame _frame;
|
||||
VCMReceiveCallback* _receiveCallback;
|
||||
VCMTiming& _timing;
|
||||
VCMTimestampMap _timestampMap;
|
||||
|
@ -57,7 +57,7 @@ VCMGenericEncoder::InitEncode(const VideoCodec* settings,
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
VCMGenericEncoder::Encode(const VideoFrame& inputFrame,
|
||||
VCMGenericEncoder::Encode(const I420VideoFrame& inputFrame,
|
||||
const CodecSpecificInfo* codecSpecificInfo,
|
||||
const std::vector<FrameType>* frameTypes) {
|
||||
std::vector<VideoFrameType> video_frame_types(frameTypes->size(),
|
||||
@ -119,7 +119,7 @@ WebRtc_Word32 VCMGenericEncoder::RequestFrame(
|
||||
if (!frame_types) {
|
||||
return 0;
|
||||
}
|
||||
VideoFrame image;
|
||||
I420VideoFrame image;
|
||||
std::vector<VideoFrameType> video_frame_types(kVideoFrameDelta);
|
||||
if (frame_types) {
|
||||
VCMEncodedFrame::ConvertFrameTypes(*frame_types, &video_frame_types);
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
* cameraFrameRate : request or information from the remote side
|
||||
* frameType : The requested frame type to encode
|
||||
*/
|
||||
WebRtc_Word32 Encode(const VideoFrame& inputFrame,
|
||||
WebRtc_Word32 Encode(const I420VideoFrame& inputFrame,
|
||||
const CodecSpecificInfo* codecSpecificInfo,
|
||||
const std::vector<FrameType>* frameTypes);
|
||||
/**
|
||||
|
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "video_coding_impl.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "common_types.h"
|
||||
#include "encoded_frame.h"
|
||||
#include "jitter_buffer.h"
|
||||
@ -652,7 +653,7 @@ VideoCodingModuleImpl::SetVideoProtection(VCMVideoProtection videoProtection,
|
||||
|
||||
// Add one raw video frame to the encoder, blocking.
|
||||
WebRtc_Word32
|
||||
VideoCodingModuleImpl::AddVideoFrame(const VideoFrame& videoFrame,
|
||||
VideoCodingModuleImpl::AddVideoFrame(const I420VideoFrame& videoFrame,
|
||||
const VideoContentMetrics* contentMetrics,
|
||||
const CodecSpecificInfo* codecSpecificInfo)
|
||||
{
|
||||
@ -685,10 +686,10 @@ VideoCodingModuleImpl::AddVideoFrame(const VideoFrame& videoFrame,
|
||||
&_nextFrameTypes);
|
||||
if (_encoderInputFile != NULL)
|
||||
{
|
||||
if (fwrite(videoFrame.Buffer(), 1, videoFrame.Length(),
|
||||
_encoderInputFile) != videoFrame.Length()) {
|
||||
return -1;
|
||||
}
|
||||
if (PrintI420VideoFrame(videoFrame, _encoderInputFile) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (ret < 0)
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
|
||||
// Add one raw video frame to the encoder, blocking.
|
||||
virtual WebRtc_Word32 AddVideoFrame(
|
||||
const VideoFrame& videoFrame,
|
||||
const I420VideoFrame& videoFrame,
|
||||
const VideoContentMetrics* _contentMetrics = NULL,
|
||||
const CodecSpecificInfo* codecSpecificInfo = NULL);
|
||||
|
||||
|
@ -54,7 +54,6 @@ class TestVideoCodingModule : public ::testing::Test {
|
||||
|
||||
virtual void TearDown() {
|
||||
VideoCodingModule::Destroy(vcm_);
|
||||
input_frame_.Free();
|
||||
}
|
||||
|
||||
void ExpectIntraRequest(int stream) {
|
||||
@ -88,7 +87,7 @@ class TestVideoCodingModule : public ::testing::Test {
|
||||
|
||||
VideoCodingModule* vcm_;
|
||||
NiceMock<MockVideoEncoder> encoder_;
|
||||
VideoFrame input_frame_;
|
||||
I420VideoFrame input_frame_;
|
||||
VideoCodec settings_;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user