webrtc_m130/modules/video_coding/video_coding_impl.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

238 lines
8.4 KiB
C
Raw Normal View History

/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* 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
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_
#define WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_
#include "webrtc/modules/video_coding/include/video_coding.h"
#include <memory>
#include <string>
#include <vector>
#include "webrtc/common_video/include/frame_callback.h"
#include "webrtc/modules/video_coding/codec_database.h"
#include "webrtc/modules/video_coding/frame_buffer.h"
#include "webrtc/modules/video_coding/generic_decoder.h"
#include "webrtc/modules/video_coding/generic_encoder.h"
#include "webrtc/modules/video_coding/jitter_buffer.h"
#include "webrtc/modules/video_coding/media_optimization.h"
#include "webrtc/modules/video_coding/qp_parser.h"
#include "webrtc/modules/video_coding/receiver.h"
#include "webrtc/modules/video_coding/timing.h"
#include "webrtc/rtc_base/onetimeevent.h"
#include "webrtc/rtc_base/sequenced_task_checker.h"
#include "webrtc/rtc_base/thread_annotations.h"
#include "webrtc/rtc_base/thread_checker.h"
#include "webrtc/system_wrappers/include/clock.h"
namespace webrtc {
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
class VideoBitrateAllocator;
class VideoBitrateAllocationObserver;
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
namespace vcm {
class VCMProcessTimer {
public:
static const int64_t kDefaultProcessIntervalMs = 1000;
VCMProcessTimer(int64_t periodMs, Clock* clock)
: _clock(clock),
_periodMs(periodMs),
_latestMs(_clock->TimeInMilliseconds()) {}
int64_t Period() const;
int64_t TimeUntilProcess() const;
void Processed();
private:
Clock* _clock;
int64_t _periodMs;
int64_t _latestMs;
};
class VideoSender : public Module {
public:
typedef VideoCodingModule::SenderNackMode SenderNackMode;
VideoSender(Clock* clock,
EncodedImageCallback* post_encode_callback,
VCMSendStatisticsCallback* send_stats_callback);
~VideoSender();
// Register the send codec to be used.
// This method must be called on the construction thread.
int32_t RegisterSendCodec(const VideoCodec* sendCodec,
uint32_t numberOfCores,
uint32_t maxPayloadSize);
void RegisterExternalEncoder(VideoEncoder* externalEncoder,
uint8_t payloadType,
bool internalSource);
int Bitrate(unsigned int* bitrate) const;
int FrameRate(unsigned int* framerate) const;
// Update the channel parameters based on new rates and rtt. This will also
// cause an immediate call to VideoEncoder::SetRateAllocation().
int32_t SetChannelParameters(
uint32_t target_bitrate_bps,
uint8_t loss_rate,
int64_t rtt,
VideoBitrateAllocator* bitrate_allocator,
VideoBitrateAllocationObserver* bitrate_updated_callback);
// Updates the channel parameters with a new bitrate allocation, but using the
// current targit_bitrate, loss rate and rtt. That is, the distribution or
// caps may be updated to a change to a new VideoCodec or allocation mode.
// The new parameters will be stored as pending EncoderParameters, and the
// encoder will only be updated on the next frame.
void UpdateChannelParemeters(
VideoBitrateAllocator* bitrate_allocator,
VideoBitrateAllocationObserver* bitrate_updated_callback);
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
// Deprecated:
// TODO(perkj): Remove once no projects use it.
int32_t RegisterProtectionCallback(VCMProtectionCallback* protection);
int32_t AddVideoFrame(const VideoFrame& videoFrame,
const CodecSpecificInfo* codecSpecificInfo);
int32_t IntraFrameRequest(size_t stream_index);
int32_t EnableFrameDropper(bool enable);
int64_t TimeUntilNextProcess() override;
void Process() override;
private:
Reland #2 of Issue 2434073003: Extract bitrate allocation ... This is yet another reland of https://codereview.webrtc.org/2434073003/ including two fixes: 1. SimulcastRateAllocator did not handle the screenshare settings properly for numSimulcastStreams = 1. Additional test case was added for that. 2. In VideoSender, when rate allocation is updated after setting a new VideoCodec config, only update the state of the EncoderParameters, but don't actually run SetRateAllocation on the encoder itself. This caused some problems upstreams. Please review only the changes after patch set 1. Original description: Extract bitrate allocation of spatial/temporal layers out of codec impl. This CL makes a number of intervowen changes: * Add BitrateAllocation struct, that contains a codec independent view of how the target bitrate is distributed over spatial and temporal layers. * Adds the BitrateAllocator interface, which takes a bitrate and frame rate and produces a BitrateAllocation. * A default (non layered) implementation is added, and SimulcastRateAllocator is extended to fully handle VP8 allocation. This includes capturing TemporalLayer instances created by the encoder. * ViEEncoder now owns both the bitrate allocator and the temporal layer factories for VP8. This allows allocation to happen fully outside of the encoder implementation. This refactoring will make it possible for ViEEncoder to signal the full picture of target bitrates to the RTCP module. BUG=webrtc:6301 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/2510583002 . Cr-Commit-Position: refs/heads/master@{#15105}
2016-11-16 16:41:30 +01:00
EncoderParameters UpdateEncoderParameters(
const EncoderParameters& params,
VideoBitrateAllocator* bitrate_allocator,
uint32_t target_bitrate_bps);
void SetEncoderParameters(EncoderParameters params, bool has_internal_source)
RTC_EXCLUSIVE_LOCKS_REQUIRED(encoder_crit_);
Clock* const clock_;
rtc::CriticalSection encoder_crit_;
VCMGenericEncoder* _encoder;
media_optimization::MediaOptimization _mediaOpt;
VCMEncodedFrameCallback _encodedFrameCallback RTC_GUARDED_BY(encoder_crit_);
EncodedImageCallback* const post_encode_callback_;
VCMSendStatisticsCallback* const send_stats_callback_;
VCMCodecDataBase _codecDataBase RTC_GUARDED_BY(encoder_crit_);
bool frame_dropper_enabled_ RTC_GUARDED_BY(encoder_crit_);
VCMProcessTimer _sendStatsTimer;
// Must be accessed on the construction thread of VideoSender.
VideoCodec current_codec_;
rtc::SequencedTaskChecker sequenced_checker_;
rtc::CriticalSection params_crit_;
EncoderParameters encoder_params_ RTC_GUARDED_BY(params_crit_);
bool encoder_has_internal_source_ RTC_GUARDED_BY(params_crit_);
std::vector<FrameType> next_frame_types_ RTC_GUARDED_BY(params_crit_);
};
class VideoReceiver : public Module {
public:
VideoReceiver(Clock* clock,
EventFactory* event_factory,
EncodedImageCallback* pre_decode_image_callback,
VCMTiming* timing,
NackSender* nack_sender = nullptr,
KeyFrameRequestSender* keyframe_request_sender = nullptr);
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ ) Reason for revert: Breaks Chrome FYI Android bots. See: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111 Original issue's description: > 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} > Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9 TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7361, 695438 Review-Url: https://codereview.webrtc.org/2792033003 Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
~VideoReceiver();
int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec,
int32_t numberOfCores,
bool requireKeyFrame);
void RegisterExternalDecoder(VideoDecoder* externalDecoder,
uint8_t payloadType);
int32_t RegisterReceiveCallback(VCMReceiveCallback* receiveCallback);
int32_t RegisterReceiveStatisticsCallback(
VCMReceiveStatisticsCallback* receiveStats);
int32_t RegisterFrameTypeCallback(VCMFrameTypeCallback* frameTypeCallback);
int32_t RegisterPacketRequestCallback(VCMPacketRequestCallback* callback);
int32_t Decode(uint16_t maxWaitTimeMs);
int32_t Decode(const webrtc::VCMEncodedFrame* frame);
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ ) Reason for revert: Breaks Chrome FYI Android bots. See: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111 Original issue's description: > 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} > Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9 TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7361, 695438 Review-Url: https://codereview.webrtc.org/2792033003 Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
// Called on the decoder thread when thread is exiting.
void DecodingStopped();
int32_t IncomingPacket(const uint8_t* incomingPayload,
size_t payloadLength,
const WebRtcRTPHeader& rtpInfo);
int32_t SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs);
int32_t SetRenderDelay(uint32_t timeMS);
int32_t Delay() const;
// DEPRECATED.
int SetReceiverRobustnessMode(
VideoCodingModule::ReceiverRobustness robustnessMode,
VCMDecodeErrorMode errorMode);
void SetNackSettings(size_t max_nack_list_size,
int max_packet_age_to_nack,
int max_incomplete_time_ms);
void SetDecodeErrorMode(VCMDecodeErrorMode decode_error_mode);
int SetMinReceiverDelay(int desired_delay_ms);
int32_t SetReceiveChannelParameters(int64_t rtt);
int32_t SetVideoProtection(VCMVideoProtection videoProtection, bool enable);
int64_t TimeUntilNextProcess() override;
void Process() override;
void TriggerDecoderShutdown();
protected:
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ ) Reason for revert: Breaks Chrome FYI Android bots. See: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111 Original issue's description: > 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} > Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9 TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7361, 695438 Review-Url: https://codereview.webrtc.org/2792033003 Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
int32_t Decode(const webrtc::VCMEncodedFrame& frame)
RTC_EXCLUSIVE_LOCKS_REQUIRED(receive_crit_);
int32_t RequestKeyFrame();
private:
rtc::ThreadChecker construction_thread_;
Clock* const clock_;
rtc::CriticalSection process_crit_;
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ ) Reason for revert: Breaks Chrome FYI Android bots. See: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111 Original issue's description: > 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} > Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9 TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7361, 695438 Review-Url: https://codereview.webrtc.org/2792033003 Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
rtc::CriticalSection receive_crit_;
VCMTiming* _timing;
VCMReceiver _receiver;
VCMDecodedFrameCallback _decodedFrameCallback;
VCMFrameTypeCallback* _frameTypeCallback RTC_GUARDED_BY(process_crit_);
VCMReceiveStatisticsCallback* _receiveStatsCallback
RTC_GUARDED_BY(process_crit_);
VCMPacketRequestCallback* _packetRequestCallback
RTC_GUARDED_BY(process_crit_);
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ ) Reason for revert: Breaks Chrome FYI Android bots. See: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111 Original issue's description: > 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} > Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9 TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7361, 695438 Review-Url: https://codereview.webrtc.org/2792033003 Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
VCMFrameBuffer _frameFromFile;
bool _scheduleKeyRequest RTC_GUARDED_BY(process_crit_);
bool drop_frames_until_keyframe_ RTC_GUARDED_BY(process_crit_);
size_t max_nack_list_size_ RTC_GUARDED_BY(process_crit_);
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ ) Reason for revert: Breaks Chrome FYI Android bots. See: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111 Original issue's description: > 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} > Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9 TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7361, 695438 Review-Url: https://codereview.webrtc.org/2792033003 Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
VCMCodecDataBase _codecDataBase RTC_GUARDED_BY(receive_crit_);
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ ) Reason for revert: Breaks Chrome FYI Android bots. See: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111 Original issue's description: > 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} > Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9 TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7361, 695438 Review-Url: https://codereview.webrtc.org/2792033003 Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
EncodedImageCallback* pre_decode_image_callback_;
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ ) Reason for revert: Breaks Chrome FYI Android bots. See: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111 Original issue's description: > 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} > Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9 TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7361, 695438 Review-Url: https://codereview.webrtc.org/2792033003 Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
VCMProcessTimer _receiveStatsTimer;
VCMProcessTimer _retransmissionTimer;
VCMProcessTimer _keyRequestTimer;
QpParser qp_parser_;
ThreadUnsafeOneTimeEvent first_frame_received_;
};
} // namespace vcm
} // namespace webrtc
#endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_