Deliver video frames on Android, on the decode thread.

VideoCoding
* Adding a method for polling for frames on Android only until the capture implementation takes care of this (longer term plan).

CodecDatabase
* Add an accessor for the current decoder
* Use std::unique_ptr<> for ownership.
* Remove "Release()" and "ReleaseDecoder()". Instead just delete.
* Remove |friend| relationship between CodecDatabase and VCMGenericDecoder.

VCMDecodedFrameCallback
* DCHECKs for thread correctness.
* Remove |lock_| now that a threading model has been established and verified.

VCMGenericDecoder
* All methods now have thread checks.
* Variable access associated with thread checkers.

VideoReceiver
* Added two notification methods, DecoderThreadStarting() and DecoderThreadStopped()
  * Allows us to establish a period when the decoder thread is not running and it is safe to modify variables such as callbacks, that are only read when the decoder thread is running.
  * Allows us to DCHECK thread guarantees.
  * Allows synchronizing callbacks from the module process thread and have them only active while the decoder thread is running.
  * The above, allows us to establish two modes for the thread, single-threaded-mutable and multi-threaded-const.
  * Using that knowledge, we can remove |receive_crit_| as well as locking for a number of member variables.

MediaCodecVideoDecoder
* Removed frame polling code from this class, since this is now done from the root thread function in VideoReceiveStream.

VideoReceiveStream
* On Android: Polls for decoded frames every 10ms (same interval as previously in MediaCodecVideoDecoder)
* [Un]Registers the |video_receiver_| with the module thread only around the time the decoder thread is started/stopped.
* Notifies the receiver of start/stop events of the decoder thread.
* Changed the decoder thread to use the new PlatformThread callback type.

BUG=webrtc:7361, 695438

Review-Url: https://codereview.webrtc.org/2764573002
Cr-Commit-Position: refs/heads/master@{#17527}
This commit is contained in:
tommi
2017-04-04 03:53:02 -07:00
committed by Commit bot
parent aa7d935cd5
commit e3aa88bbd5
12 changed files with 511 additions and 321 deletions

View File

@ -138,6 +138,14 @@ bool VideoDecoderSoftwareFallbackWrapper::PrefersLateDecoding() const {
return decoder_->PrefersLateDecoding();
}
#if defined(WEBRTC_ANDROID)
void VideoDecoderSoftwareFallbackWrapper::PollDecodedFrames() {
if (fallback_decoder_)
return fallback_decoder_->PollDecodedFrames();
return decoder_->PollDecodedFrames();
}
#endif
const char* VideoDecoderSoftwareFallbackWrapper::ImplementationName() const {
if (fallback_decoder_)
return fallback_implementation_name_.c_str();