Use external VideoDecoders in VideoReceiveStream.

Removes direct VideoCodec use from the new API, exposes VideoDecoders
through webrtc/video_decoder.h similar to VideoEncoders.

Also includes some preparation for wiring up external decoders in
WebRtcVideoEngine2 by adding AllocatedDecoders that specify whether they
were allocated internally or externally.

Additionally addresses a data race in VideoReceiver that was exposed with this change.

R=mflodman@webrtc.org, stefan@webrtc.org
TBR=pthatcher@webrtc.org
BUG=2854,1667

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7560 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org
2014-10-29 15:28:39 +00:00
parent 2dd3134e50
commit 776e6f289c
21 changed files with 261 additions and 234 deletions

View File

@ -186,7 +186,8 @@ class VideoReceiver {
void RegisterPreDecodeImageCallback(EncodedImageCallback* observer);
protected:
int32_t Decode(const webrtc::VCMEncodedFrame& frame);
int32_t Decode(const webrtc::VCMEncodedFrame& frame)
EXCLUSIVE_LOCKS_REQUIRED(_receiveCritSect);
int32_t RequestKeyFrame();
int32_t RequestSliceLossIndication(const uint64_t pictureID) const;
int32_t NackList(uint16_t* nackList, uint16_t* size);
@ -230,7 +231,7 @@ class VideoReceiver {
size_t max_nack_list_size_ GUARDED_BY(process_crit_sect_);
EncodedImageCallback* pre_decode_image_callback_ GUARDED_BY(_receiveCritSect);
VCMCodecDataBase _codecDataBase;
VCMCodecDataBase _codecDataBase GUARDED_BY(_receiveCritSect);
VCMProcessTimer _receiveStatsTimer;
VCMProcessTimer _retransmissionTimer;
VCMProcessTimer _keyRequestTimer;

View File

@ -280,11 +280,11 @@ int32_t VideoReceiver::InitializeReceiver() {
if (ret < 0) {
return ret;
}
_codecDataBase.ResetReceiver();
_timing.Reset();
{
CriticalSectionScoped receive_cs(_receiveCritSect);
_codecDataBase.ResetReceiver();
_timing.Reset();
_receiverInited = true;
}
@ -369,6 +369,7 @@ int VideoReceiver::RegisterRenderBufferSizeCallback(
// Should be called as often as possible to get the most out of the decoder.
int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
int64_t nextRenderTimeMs;
bool supports_render_scheduling;
{
CriticalSectionScoped cs(_receiveCritSect);
if (!_receiverInited) {
@ -377,6 +378,7 @@ int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
if (!_codecDataBase.DecoderRegistered()) {
return VCM_NO_CODEC_REGISTERED;
}
supports_render_scheduling = _codecDataBase.SupportsRenderScheduling();
}
const bool dualReceiverEnabledNotReceiving = (
@ -385,7 +387,7 @@ int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
VCMEncodedFrame* frame =
_receiver.FrameForDecoding(maxWaitTimeMs,
nextRenderTimeMs,
_codecDataBase.SupportsRenderScheduling(),
supports_render_scheduling,
&_dualReceiver);
if (dualReceiverEnabledNotReceiving && _dualReceiver.State() == kReceiving) {