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

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

@ -143,7 +143,7 @@ VCMGenericEncoder* VCMCodecDataBase::CreateEncoder(
{ {
#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