Changed VP8 to follow the style guide a little bit more.

Review URL: https://webrtc-codereview.appspot.com/379003

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1593 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org 2012-02-02 12:21:47 +00:00
parent 9b3474aff8
commit 4ea57e5e26
9 changed files with 1019 additions and 1241 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -51,8 +51,8 @@ class VideoProcessorIntegrationTest: public testing::Test {
virtual ~VideoProcessorIntegrationTest() {} virtual ~VideoProcessorIntegrationTest() {}
void SetUp() { void SetUp() {
encoder_ = new VP8Encoder(); encoder_ = VP8Encoder::Create();
decoder_ = new VP8Decoder(); decoder_ = VP8Decoder::Create();
// Setup the TestConfig struct for processing of a clip in CIF resolution. // Setup the TestConfig struct for processing of a clip in CIF resolution.
config_.input_filename = config_.input_filename =

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -462,8 +462,8 @@ int main(int argc, char* argv[]) {
PrintConfigurationSummary(config); PrintConfigurationSummary(config);
webrtc::VP8Encoder encoder; webrtc::VP8Encoder* encoder = webrtc::VP8Encoder::Create();
webrtc::VP8Decoder decoder; webrtc::VP8Decoder* decoder = webrtc::VP8Decoder::Create();
webrtc::test::Stats stats; webrtc::test::Stats stats;
webrtc::test::FrameReaderImpl frame_reader(config.input_filename, webrtc::test::FrameReaderImpl frame_reader(config.input_filename,
config.frame_length_in_bytes); config.frame_length_in_bytes);
@ -475,7 +475,7 @@ int main(int argc, char* argv[]) {
webrtc::test::PacketManipulatorImpl packet_manipulator( webrtc::test::PacketManipulatorImpl packet_manipulator(
&packet_reader, config.networking_config, config.verbose); &packet_reader, config.networking_config, config.verbose);
webrtc::test::VideoProcessorImpl processor(&encoder, &decoder, webrtc::test::VideoProcessorImpl processor(encoder, decoder,
&frame_reader, &frame_reader,
&frame_writer, &frame_writer,
&packet_manipulator, &packet_manipulator,
@ -494,8 +494,8 @@ int main(int argc, char* argv[]) {
Log("Processed %d frames\n", frame_number); Log("Processed %d frames\n", frame_number);
// Release encoder and decoder to make sure they have finished processing. // Release encoder and decoder to make sure they have finished processing.
encoder.Release(); encoder->Release();
decoder.Release(); decoder->Release();
// Verify statistics are correct: // Verify statistics are correct:
assert(frame_number == static_cast<int>(stats.stats_.size())); assert(frame_number == static_cast<int>(stats.stats_.size()));
@ -517,6 +517,8 @@ int main(int argc, char* argv[]) {
if (FLAGS_python) { if (FLAGS_python) {
PrintPythonOutput(config, stats, ssim_result, psnr_result); PrintPythonOutput(config, stats, ssim_result, psnr_result);
} }
delete encoder;
delete decoder;
Log("Quality test finished!"); Log("Quality test finished!");
return 0; return 0;
} }

View File

@ -1,19 +1,15 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found * tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may * in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ *
/*
* vp8.h
* WEBRTC VP8 wrapper interface * WEBRTC VP8 wrapper interface
*/ */
#ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_H_ #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_H_
#define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_H_ #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_H_
@ -32,243 +28,231 @@ namespace webrtc
class TemporalLayers; class TemporalLayers;
class ReferencePictureSelection; class ReferencePictureSelection;
/******************************/ class VP8Encoder : public VideoEncoder {
/* VP8Encoder class */ public:
/******************************/ static VP8Encoder* Create();
class VP8Encoder : public VideoEncoder
{
public:
VP8Encoder();
virtual ~VP8Encoder();
// Free encoder memory. virtual ~VP8Encoder();
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual WebRtc_Word32 Release();
// Reset encoder state and prepare for a new call. // Free encoder memory.
// //
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
// <0 - Errors: virtual int Release();
// WEBRTC_VIDEO_CODEC_ERR_PARAMETER
// WEBRTC_VIDEO_CODEC_ERROR
virtual WebRtc_Word32 Reset();
// Initialize the encoder with the information from the codecSettings // Reset encoder state and prepare for a new call.
// //
// Input: // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
// - codecSettings : Codec settings // <0 - Errors:
// - numberOfCores : Number of cores available for the encoder // WEBRTC_VIDEO_CODEC_ERR_PARAMETER
// - maxPayloadSize : The maximum size each payload is allowed // WEBRTC_VIDEO_CODEC_ERROR
// to have. Usually MTU - overhead. virtual int Reset();
//
// Return value : Set bit rate if OK
// <0 - Errors:
// WEBRTC_VIDEO_CODEC_ERR_PARAMETER
// WEBRTC_VIDEO_CODEC_ERR_SIZE
// WEBRTC_VIDEO_CODEC_LEVEL_EXCEEDED
// WEBRTC_VIDEO_CODEC_MEMORY
// WEBRTC_VIDEO_CODEC_ERROR
virtual WebRtc_Word32 InitEncode(const VideoCodec* codecSettings,
WebRtc_Word32 numberOfCores,
WebRtc_UWord32 maxPayloadSize);
// Encode an I420 image (as a part of a video stream). The encoded image // Initialize the encoder with the information from the codecSettings
// will be returned to the user through the encode complete callback. //
// // Input:
// Input: // - codec_settings : Codec settings
// - inputImage : Image to be encoded // - number_of_cores : Number of cores available for the encoder
// - frameTypes : Frame type to be generated by the encoder. // - max_payload_size : The maximum size each payload is allowed
// // to have. Usually MTU - overhead.
// Return value : WEBRTC_VIDEO_CODEC_OK if OK //
// <0 - Errors: // Return value : Set bit rate if OK
// WEBRTC_VIDEO_CODEC_ERR_PARAMETER // <0 - Errors:
// WEBRTC_VIDEO_CODEC_MEMORY // WEBRTC_VIDEO_CODEC_ERR_PARAMETER
// WEBRTC_VIDEO_CODEC_ERROR // WEBRTC_VIDEO_CODEC_ERR_SIZE
// WEBRTC_VIDEO_CODEC_TIMEOUT // WEBRTC_VIDEO_CODEC_LEVEL_EXCEEDED
// WEBRTC_VIDEO_CODEC_MEMORY
// WEBRTC_VIDEO_CODEC_ERROR
virtual int InitEncode(const VideoCodec* codec_settings,
int number_of_cores,
uint32_t max_payload_size);
virtual WebRtc_Word32 Encode(const RawImage& inputImage, // Encode an I420 image (as a part of a video stream). The encoded image
const CodecSpecificInfo* codecSpecificInfo, // will be returned to the user through the encode complete callback.
const VideoFrameType* frameTypes); //
// Input:
// - input_image : Image to be encoded
// - frame_types : Frame type to be generated by the encoder.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK
// <0 - Errors:
// WEBRTC_VIDEO_CODEC_ERR_PARAMETER
// WEBRTC_VIDEO_CODEC_MEMORY
// WEBRTC_VIDEO_CODEC_ERROR
// WEBRTC_VIDEO_CODEC_TIMEOUT
// Register an encode complete callback object. virtual int Encode(const RawImage& input_image,
// const CodecSpecificInfo* codec_specific_info,
// Input: const VideoFrameType* frame_types);
// - callback : Callback object which handles encoded images.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual WebRtc_Word32 RegisterEncodeCompleteCallback(EncodedImageCallback*
callback);
// Inform the encoder of the new packet loss rate and the round-trip time of the // Register an encode complete callback object.
// network. //
// // Input:
// - packetLoss : Fraction lost // - callback : Callback object which handles encoded images.
// (loss rate in percent = 100 * packetLoss / 255) //
// - rtt : Round-trip time in milliseconds // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
// Return value : WEBRTC_VIDEO_CODEC_OK if OK virtual int RegisterEncodeCompleteCallback(EncodedImageCallback* callback);
// <0 - Errors:
// WEBRTC_VIDEO_CODEC_ERROR
//
virtual WebRtc_Word32 SetChannelParameters(WebRtc_UWord32 packetLoss,
int rtt);
// Inform the encoder about the new target bit rate. // Inform the encoder of the new packet loss rate and the round-trip time of
// // the network.
// - newBitRate : New target bit rate //
// - frameRate : The target frame rate // - packet_loss : Fraction lost
// // (loss rate in percent = 100 * packetLoss / 255)
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. // - rtt : Round-trip time in milliseconds
virtual WebRtc_Word32 SetRates(WebRtc_UWord32 newBitRateKbit, // Return value : WEBRTC_VIDEO_CODEC_OK if OK
WebRtc_UWord32 frameRate); // <0 - Errors: WEBRTC_VIDEO_CODEC_ERROR
//
virtual int SetChannelParameters(uint32_t packet_loss, int rtt);
// Get version number for the codec. // Inform the encoder about the new target bit rate.
// //
// Input: // - new_bitrate_kbit : New target bit rate
// - version : Pointer to allocated char buffer. // - frame_rate : The target frame rate
// - buflen : Length of provided char buffer. //
// // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
// Output: virtual int SetRates(uint32_t new_bitrate_kbit, uint32_t frame_rate);
// - version : Version number string written to char buffer.
//
// Return value : >0 - Length of written string.
// <0 - WEBRTC_VIDEO_CODEC_ERR_SIZE
virtual WebRtc_Word32 Version(WebRtc_Word8 *version,
WebRtc_Word32 length) const;
static WebRtc_Word32 VersionStatic(WebRtc_Word8 *version,
WebRtc_Word32 length);
private: // Get version number for the codec.
// Call encoder initialize function and set control settings. //
WebRtc_Word32 InitAndSetControlSettings(); // Input:
// - version : Pointer to allocated char buffer.
// - length : Length of provided char buffer.
//
// Output:
// - version : Version number string written to char buffer.
//
// Return value : >0 - Length of written string.
// <0 - WEBRTC_VIDEO_CODEC_ERR_SIZE
virtual int Version(char *version, int length) const;
void PopulateCodecSpecific(CodecSpecificInfo* codec_specific, static int VersionStatic(char *version, int length);
const vpx_codec_cx_pkt& pkt);
WebRtc_Word32 GetEncodedFrame(const RawImage& input_image); private:
VP8Encoder();
WebRtc_Word32 GetEncodedPartitions(const RawImage& input_image); // Call encoder initialize function and set control settings.
int InitAndSetControlSettings();
// Determine maximum target for Intra frames void PopulateCodecSpecific(CodecSpecificInfo* codec_specific,
// const vpx_codec_cx_pkt& pkt);
// Input:
// - optimalBuffersize : Optimal buffer size
// Return Value : Max target size for Intra frames represented as
// percentage of the per frame bandwidth
WebRtc_UWord32 MaxIntraTarget(WebRtc_UWord32 optimalBuffersize);
EncodedImage _encodedImage; int GetEncodedFrame(const RawImage& input_image);
EncodedImageCallback* _encodedCompleteCallback;
WebRtc_Word32 _width;
WebRtc_Word32 _height;
WebRtc_Word32 _maxBitRateKbit;
WebRtc_UWord32 _maxFrameRate;
bool _inited;
WebRtc_UWord32 _timeStamp;
WebRtc_UWord16 _pictureID;
WebRtc_UWord8 _simulcastIdx;
bool _feedbackModeOn;
int _cpuSpeed;
WebRtc_UWord32 _rcMaxIntraTarget;
int _tokenPartitions;
ReferencePictureSelection* _rps;
TemporalLayers* _temporalLayers;
vpx_codec_ctx_t* _encoder;
vpx_codec_enc_cfg_t* _cfg;
vpx_image_t* _raw;
};// end of VP8Encoder class
/******************************/ int GetEncodedPartitions(const RawImage& input_image);
/* VP8Decoder class */
/******************************/
class VP8Decoder : public VideoDecoder
{
public:
VP8Decoder();
virtual ~VP8Decoder();
// Initialize the decoder. // Determine maximum target for Intra frames
// //
// Return value : WEBRTC_VIDEO_CODEC_OK. // Input:
// <0 - Errors: // - optimal_buffer_size : Optimal buffer size
// WEBRTC_VIDEO_CODEC_ERROR // Return Value : Max target size for Intra frames represented as
virtual WebRtc_Word32 InitDecode(const VideoCodec* inst, // percentage of the per frame bandwidth
WebRtc_Word32 numberOfCores); uint32_t MaxIntraTarget(uint32_t optimal_buffer_size);
// Decode encoded image (as a part of a video stream). The decoded image EncodedImage encoded_image_;
// will be returned to the user through the decode complete callback. EncodedImageCallback* encoded_complete_callback_;
// VideoCodec codec_;
// Input: bool inited_;
// - inputImage : Encoded image to be decoded uint32_t timestamp_;
// - missingFrames : True if one or more frames have been lost uint16_t picture_id_;
// since the previous decode call. bool feedback_mode_;
// - fragmentation : Specifies the start and length of each VP8 int cpu_speed_;
// partition. uint32_t rc_max_intra_target_;
// - codecSpecificInfo : pointer to specific codec data int token_partitions_;
// - renderTimeMs : Render time in Ms ReferencePictureSelection* rps_;
// TemporalLayers* temporal_layers_;
// Return value : WEBRTC_VIDEO_CODEC_OK if OK vpx_codec_ctx_t* encoder_;
// <0 - Errors: vpx_codec_enc_cfg_t* config_;
// WEBRTC_VIDEO_CODEC_ERROR vpx_image_t* raw_;
// WEBRTC_VIDEO_CODEC_ERR_PARAMETER }; // end of VP8Encoder class
virtual WebRtc_Word32 Decode(const EncodedImage& inputImage,
bool missingFrames,
const RTPFragmentationHeader* fragmentation,
const CodecSpecificInfo* codecSpecificInfo,
WebRtc_Word64 /*renderTimeMs*/);
// Register a decode complete callback object.
//
// Input:
// - callback : Callback object which handles decoded images.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual WebRtc_Word32 RegisterDecodeCompleteCallback(DecodedImageCallback*
callback);
// Free decoder memory. class VP8Decoder : public VideoDecoder {
// public:
// Return value : WEBRTC_VIDEO_CODEC_OK if OK static VP8Decoder* Create();
// <0 - Errors:
// WEBRTC_VIDEO_CODEC_ERROR
virtual WebRtc_Word32 Release();
// Reset decoder state and prepare for a new call. virtual ~VP8Decoder();
//
// Return value : WEBRTC_VIDEO_CODEC_OK.
// <0 - Errors:
// WEBRTC_VIDEO_CODEC_UNINITIALIZED
// WEBRTC_VIDEO_CODEC_ERROR
virtual WebRtc_Word32 Reset();
// Create a copy of the codec and its internal state. // Initialize the decoder.
// //
// Return value : A copy of the instance if OK, NULL otherwise. // Return value : WEBRTC_VIDEO_CODEC_OK.
virtual VideoDecoder* Copy(); // <0 - Errors:
// WEBRTC_VIDEO_CODEC_ERROR
virtual int InitDecode(const VideoCodec* inst, int number_of_cores);
private: // Decode encoded image (as a part of a video stream). The decoded image
// Copy reference image from this _decoder to the _decoder in copyTo. Set which // will be returned to the user through the decode complete callback.
// frame type to copy in _refFrame->frame_type before the call to this function. //
int CopyReference(VP8Decoder* copyTo); // Input:
// - input_image : Encoded image to be decoded
// - missing_frames : True if one or more frames have been lost
// since the previous decode call.
// - fragmentation : Specifies the start and length of each VP8
// partition.
// - codec_specific_info : pointer to specific codec data
// - render_time_ms : Render time in Ms
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK
// <0 - Errors:
// WEBRTC_VIDEO_CODEC_ERROR
// WEBRTC_VIDEO_CODEC_ERR_PARAMETER
virtual int Decode(const EncodedImage& input_image,
bool missing_frames,
const RTPFragmentationHeader* fragmentation,
const CodecSpecificInfo* codec_specific_info,
int64_t /*render_time_ms*/);
WebRtc_Word32 DecodePartitions(const EncodedImage& input_image, // Register a decode complete callback object.
const RTPFragmentationHeader* fragmentation); //
// Input:
// - callback : Callback object which handles decoded images.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
virtual int RegisterDecodeCompleteCallback(DecodedImageCallback* callback);
WebRtc_Word32 ReturnFrame(const vpx_image_t* img, WebRtc_UWord32 timeStamp); // Free decoder memory.
//
// Return value : WEBRTC_VIDEO_CODEC_OK if OK
// <0 - Errors:
// WEBRTC_VIDEO_CODEC_ERROR
virtual int Release();
RawImage _decodedImage; // Reset decoder state and prepare for a new call.
DecodedImageCallback* _decodeCompleteCallback; //
bool _inited; // Return value : WEBRTC_VIDEO_CODEC_OK.
bool _feedbackModeOn; // <0 - Errors:
vpx_dec_ctx_t* _decoder; // WEBRTC_VIDEO_CODEC_UNINITIALIZED
VideoCodec* _inst; // WEBRTC_VIDEO_CODEC_ERROR
WebRtc_Word32 _numCores; virtual int Reset();
EncodedImage _lastKeyFrame;
int _imageFormat; // Create a copy of the codec and its internal state.
vpx_ref_frame_t* _refFrame; //
int _propagationCnt; // Return value : A copy of the instance if OK, NULL otherwise.
bool _latestKeyFrameComplete; virtual VideoDecoder* Copy();
};// end of VP8Decoder class
} // namespace webrtc private:
VP8Decoder();
// Copy reference image from this _decoder to the _decoder in copyTo. Set
// which frame type to copy in _refFrame->frame_type before the call to
// this function.
int CopyReference(VP8Decoder* copy);
int DecodePartitions(const EncodedImage& input_image,
const RTPFragmentationHeader* fragmentation);
int ReturnFrame(const vpx_image_t* img, uint32_t timeStamp);
RawImage decoded_image_;
DecodedImageCallback* decode_complete_callback_;
bool inited_;
bool feedback_mode_;
vpx_dec_ctx_t* decoder_;
VideoCodec codec_;
EncodedImage last_keyframe_;
int image_format_;
vpx_ref_frame_t* ref_frame_;
int propagation_cnt_;
bool latest_keyframe_complete_;
}; // end of VP8Decoder class
} // namespace webrtc
#endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_H_ #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -15,34 +15,25 @@
using namespace webrtc; using namespace webrtc;
VP8Benchmark::VP8Benchmark() VP8Benchmark::VP8Benchmark()
: : Benchmark("VP8Benchmark", "VP8 benchmark over a range of test cases",
Benchmark("VP8Benchmark", "VP8 benchmark over a range of test cases", webrtc::test::OutputPath() + "VP8Benchmark.txt", "VP8") {
webrtc::test::OutputPath() + "VP8Benchmark.txt", "VP8")
{
} }
VP8Benchmark::VP8Benchmark(std::string name, std::string description) VP8Benchmark::VP8Benchmark(std::string name, std::string description)
: : Benchmark(name, description,
Benchmark(name, description, webrtc::test::OutputPath() + "VP8Benchmark.txt", webrtc::test::OutputPath() + "VP8Benchmark.txt",
"VP8") "VP8") {
{
} }
VP8Benchmark::VP8Benchmark(std::string name, std::string description, VP8Benchmark::VP8Benchmark(std::string name, std::string description,
std::string resultsFileName) std::string resultsFileName)
: : Benchmark(name, description, resultsFileName, "VP8") {
Benchmark(name, description, resultsFileName, "VP8")
{
} }
VideoEncoder* VideoEncoder* VP8Benchmark::GetNewEncoder() {
VP8Benchmark::GetNewEncoder() return VP8Encoder::Create();
{
return new VP8Encoder();
} }
VideoDecoder* VideoDecoder* VP8Benchmark::GetNewDecoder() {
VP8Benchmark::GetNewDecoder() return VP8Decoder::Create();
{
return new VP8Decoder();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -18,14 +18,14 @@
VP8RpsTest::VP8RpsTest(float bitRate) VP8RpsTest::VP8RpsTest(float bitRate)
: VP8NormalAsyncTest(bitRate), : VP8NormalAsyncTest(bitRate),
decoder2_(new webrtc::VP8Decoder), decoder2_(webrtc::VP8Decoder::Create()),
sli_(false) { sli_(false) {
} }
VP8RpsTest::VP8RpsTest() VP8RpsTest::VP8RpsTest()
: VP8NormalAsyncTest("VP8 Reference Picture Selection Test", : VP8NormalAsyncTest("VP8 Reference Picture Selection Test",
"VP8 Reference Picture Selection Test", 1), "VP8 Reference Picture Selection Test", 1),
decoder2_(new webrtc::VP8Decoder), decoder2_(webrtc::VP8Decoder::Create()),
sli_(false) { sli_(false) {
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -45,8 +45,8 @@ int main()
std::vector<Test*>::iterator it; std::vector<Test*>::iterator it;
for (it = tests.begin() ; it < tests.end(); it++) for (it = tests.begin() ; it < tests.end(); it++)
{ {
enc = new VP8Encoder(); enc = VP8Encoder::Create();
dec = new VP8Decoder(); dec = VP8Decoder::Create();
(*it)->SetEncoder(enc); (*it)->SetEncoder(enc);
(*it)->SetDecoder(dec); (*it)->SetDecoder(dec);
(*it)->SetLog(&log); (*it)->SetLog(&log);

View File

@ -141,9 +141,9 @@ VCMGenericEncoder* VCMCodecDataBase::CreateEncoder(
switch(type) switch(type)
{ {
#ifdef VIDEOCODEC_VP8 #ifdef VIDEOCODEC_VP8
case kVideoCodecVP8: case kVideoCodecVP8:
return new VCMGenericEncoder(*(new VP8Encoder)); return new VCMGenericEncoder(*(VP8Encoder::Create()));
#endif #endif
#ifdef VIDEOCODEC_I420 #ifdef VIDEOCODEC_I420
case kVideoCodecI420: case kVideoCodecI420:
@ -739,7 +739,7 @@ VCMCodecDataBase::CreateDecoder(VideoCodecType type) const
{ {
#ifdef VIDEOCODEC_VP8 #ifdef VIDEOCODEC_VP8
case kVideoCodecVP8: case kVideoCodecVP8:
return new VCMGenericDecoder(*(new VP8Decoder), _id); return new VCMGenericDecoder(*(VP8Decoder::Create()), _id);
#endif #endif
#ifdef VIDEOCODEC_I420 #ifdef VIDEOCODEC_I420
case kVideoCodecI420: case kVideoCodecI420:

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -181,12 +181,12 @@ CodecDataBaseTest::Perform(CmdArgs& args)
_vcm->InitializeReceiver(); _vcm->InitializeReceiver();
VP8Decoder* decoder = new VP8Decoder; VP8Decoder* decoder = VP8Decoder::Create();
VideoCodec vp8DecSettings; VideoCodec vp8DecSettings;
VideoCodingModule::Codec(kVideoCodecVP8, &vp8DecSettings); VideoCodingModule::Codec(kVideoCodecVP8, &vp8DecSettings);
TEST(_vcm->RegisterExternalDecoder(decoder, vp8DecSettings.plType, false) == VCM_OK); TEST(_vcm->RegisterExternalDecoder(decoder, vp8DecSettings.plType, false) == VCM_OK);
TEST(_vcm->RegisterReceiveCodec(&vp8DecSettings, 1, false) == VCM_OK); TEST(_vcm->RegisterReceiveCodec(&vp8DecSettings, 1, false) == VCM_OK);
VP8Encoder* encoder = new VP8Encoder; VP8Encoder* encoder = VP8Encoder::Create();
VideoCodec vp8EncSettings; VideoCodec vp8EncSettings;
VideoCodingModule::Codec(kVideoCodecVP8, &vp8EncSettings); VideoCodingModule::Codec(kVideoCodecVP8, &vp8EncSettings);
_vcm->RegisterTransportCallback(_encodeCallback); // encode returns error if callback uninitialized _vcm->RegisterTransportCallback(_encodeCallback); // encode returns error if callback uninitialized