Isolate register post encode callback in video coding module to simplify code and critical sections.

R=marpan@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5357 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andresp@webrtc.org
2014-01-09 08:01:57 +00:00
parent bb0de3ca9f
commit 1df9dc3957
6 changed files with 50 additions and 38 deletions

View File

@ -142,15 +142,15 @@ VCMGenericEncoder::InternalSource() const
/***************************
* Callback Implementation
***************************/
VCMEncodedFrameCallback::VCMEncodedFrameCallback():
VCMEncodedFrameCallback::VCMEncodedFrameCallback(
EncodedImageCallback* post_encode_callback):
_sendCallback(),
_mediaOpt(NULL),
_encodedBytes(0),
_payloadType(0),
_codecType(kVideoCodecUnknown),
_internalSource(false),
post_encode_callback_lock_(CriticalSectionWrapper::CreateCriticalSection()),
post_encode_callback_(NULL)
post_encode_callback_(post_encode_callback)
#ifdef DEBUG_ENCODER_BIT_STREAM
, _bitStreamAfterEncoder(NULL)
#endif
@ -180,12 +180,8 @@ VCMEncodedFrameCallback::Encoded(
const CodecSpecificInfo* codecSpecificInfo,
const RTPFragmentationHeader* fragmentationHeader)
{
{
CriticalSectionScoped cs(post_encode_callback_lock_.get());
if (post_encode_callback_) {
post_encode_callback_->Encoded(encodedImage);
}
}
post_encode_callback_->Encoded(encodedImage);
FrameType frameType = VCMEncodedFrame::ConvertFrameType(encodedImage._frameType);
uint32_t encodedBytes = 0;
@ -280,10 +276,4 @@ void VCMEncodedFrameCallback::CopyCodecSpecific(const CodecSpecificInfo& info,
return;
}
}
void VCMEncodedFrameCallback::RegisterPostEncodeImageCallback(
EncodedImageCallback* callback) {
CriticalSectionScoped cs(post_encode_callback_lock_.get());
post_encode_callback_ = callback;
}
} // namespace webrtc