webrtc_m130/webrtc/modules/video_coding/generic_decoder.cc

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

232 lines
8.5 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.
*/
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
Reland of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2853383005/ ) Reason for revert: Downstream projects have been fixed. Original issue's description: > Revert of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2854873003/ ) > > Reason for revert: > More downstream breakage discovered. > > Original issue's description: > > Reland of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2854883002/ ) > > > > Reason for revert: > > Will make another attempt to track down and fix downstream projects. > > > > Original issue's description: > > > Revert of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2852303002/ ) > > > > > > Reason for revert: > > > Unfortunately, more downstream updates needed. > > > > > > Original issue's description: > > > > Reland of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2845333002/ ) > > > > > > > > Reason for revert: > > > > Downstream projects being updated. > > > > > > > > For Chrome, relanding depends on cl > > > > https://codereview.chromium.org/2855783003/ > > > > > > > > Original issue's description: > > > > > Revert of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #17 id:320001 of https://codereview.webrtc.org/2622263002/ ) > > > > > > > > > > Reason for revert: > > > > > Broke Chrome build, see, e.g., > > > > > http://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/16237 > > > > > > > > > > Original issue's description: > > > > > > Delete deprecated and transitional stuff related to video frame refactoring. > > > > > > > > > > > > BUG=webrtc:5880 > > > > > > > > > > > > Review-Url: https://codereview.webrtc.org/2622263002 > > > > > > Cr-Commit-Position: refs/heads/master@{#17928} > > > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/713a3bbcc74a4c1a1f54d6dbd0bdaa715f5c1ae1 > > > > > > > > > > TBR=mflodman@webrtc.org,perkj@webrtc.org > > > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > > > NOPRESUBMIT=true > > > > > NOTREECHECKS=true > > > > > NOTRY=true > > > > > BUG=webrtc:5880 > > > > > > > > > > Review-Url: https://codereview.webrtc.org/2845333002 > > > > > Cr-Commit-Position: refs/heads/master@{#17929} > > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/aec49d2b49e1beceb286cbb29ad220aefd0ac648 > > > > > > > > TBR=mflodman@webrtc.org,perkj@webrtc.org > > > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > > > BUG=webrtc:5880 > > > > > > > > Review-Url: https://codereview.webrtc.org/2852303002 > > > > Cr-Commit-Position: refs/heads/master@{#17974} > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/d71ebd70f6c40a37559a7ee2930002a804ad3f13 > > > > > > TBR=mflodman@webrtc.org,perkj@webrtc.org > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > NOPRESUBMIT=true > > > NOTREECHECKS=true > > > NOTRY=true > > > BUG=webrtc:5880 > > > > > > Review-Url: https://codereview.webrtc.org/2854883002 > > > Cr-Commit-Position: refs/heads/master@{#17978} > > > Committed: https://chromium.googlesource.com/external/webrtc/+/6e6a485a028799501ea4753ceefc811dd826f52f > > > > TBR=mflodman@webrtc.org,perkj@webrtc.org > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > > > BUG=webrtc:5880 > > > > Review-Url: https://codereview.webrtc.org/2854873003 > > Cr-Commit-Position: refs/heads/master@{#18006} > > Committed: https://chromium.googlesource.com/external/webrtc/+/3870a071c452dc2e782196bc5bba0375d019b653 > > TBR=mflodman@webrtc.org,perkj@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:5880 > > Review-Url: https://codereview.webrtc.org/2853383005 > Cr-Commit-Position: refs/heads/master@{#18008} > Committed: https://chromium.googlesource.com/external/webrtc/+/61b22dde133aff91a0db6a628d87b2ea9134fa15 TBR=mflodman@webrtc.org,perkj@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:5880 Review-Url: https://codereview.webrtc.org/2867703002 Cr-Commit-Position: refs/heads/master@{#18081}
2017-05-10 05:25:59 -07:00
#include "webrtc/base/timeutils.h"
#include "webrtc/base/trace_event.h"
#include "webrtc/modules/video_coding/include/video_coding.h"
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
#include "webrtc/modules/video_coding/generic_decoder.h"
#include "webrtc/modules/video_coding/internal_defines.h"
#include "webrtc/system_wrappers/include/clock.h"
namespace webrtc {
VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming* timing,
Clock* clock)
: _clock(clock),
_timing(timing),
_timestampMap(kDecoderFrameMemoryLength),
_lastReceivedPictureID(0) {
ntp_offset_ =
_clock->CurrentNtpInMilliseconds() - _clock->TimeInMilliseconds();
}
VCMDecodedFrameCallback::~VCMDecodedFrameCallback() {
}
void VCMDecodedFrameCallback::SetUserReceiveCallback(
VCMReceiveCallback* receiveCallback) {
RTC_DCHECK(construction_thread_.CalledOnValidThread());
RTC_DCHECK((!_receiveCallback && receiveCallback) ||
(_receiveCallback && !receiveCallback));
_receiveCallback = receiveCallback;
}
VCMReceiveCallback* VCMDecodedFrameCallback::UserReceiveCallback() {
// Called on the decode thread via VCMCodecDataBase::GetDecoder.
// The callback must always have been set before this happens.
RTC_DCHECK(_receiveCallback);
return _receiveCallback;
}
int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) {
return Decoded(decodedImage, -1);
}
int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
int64_t decode_time_ms) {
Decoded(decodedImage,
decode_time_ms >= 0 ? rtc::Optional<int32_t>(decode_time_ms)
: rtc::Optional<int32_t>(),
rtc::Optional<uint8_t>());
return WEBRTC_VIDEO_CODEC_OK;
}
void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
rtc::Optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) {
RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point";
TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
"timestamp", decodedImage.timestamp());
// TODO(holmer): We should improve this so that we can handle multiple
// callbacks from one call to Decode().
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
VCMFrameInformation* frameInfo;
{
rtc::CritScope cs(&lock_);
frameInfo = _timestampMap.Pop(decodedImage.timestamp());
}
if (frameInfo == NULL) {
LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping "
"this one.";
return;
}
const int64_t now_ms = _clock->TimeInMilliseconds();
if (!decode_time_ms) {
decode_time_ms =
rtc::Optional<int32_t>(now_ms - frameInfo->decodeStartTimeMs);
}
_timing->StopDecodeTimer(decodedImage.timestamp(), *decode_time_ms, now_ms,
frameInfo->renderTimeMs);
// Report timing information.
if (frameInfo->timing.is_timing_frame) {
// Convert remote timestamps to local time from ntp timestamps.
frameInfo->timing.encode_start_ms -= ntp_offset_;
frameInfo->timing.encode_finish_ms -= ntp_offset_;
frameInfo->timing.packetization_finish_ms -= ntp_offset_;
frameInfo->timing.pacer_exit_ms -= ntp_offset_;
frameInfo->timing.network_timestamp_ms -= ntp_offset_;
frameInfo->timing.network2_timestamp_ms -= ntp_offset_;
// TODO(ilnik): Report timing information here.
// Capture time: decodedImage.ntp_time_ms() - ntp_offset
// Encode start: frameInfo->timing.encode_start_ms
// Encode finish: frameInfo->timing.encode_finish_ms
// Packetization done: frameInfo->timing.packetization_finish_ms
// Pacer exit: frameInfo->timing.pacer_exit_ms
// Network timestamp: frameInfo->timing.network_timestamp_ms
// Network2 timestamp: frameInfo->timing.network2_timestamp_ms
// Receive start: frameInfo->timing.receive_start_ms
// Receive finish: frameInfo->timing.receive_finish_ms
// Decode start: frameInfo->decodeStartTimeMs
// Decode finish: now_ms
// Render time: frameInfo->renderTimeMs
}
decodedImage.set_timestamp_us(
frameInfo->renderTimeMs * rtc::kNumMicrosecsPerMillisec);
decodedImage.set_rotation(frameInfo->rotation);
_receiveCallback->FrameToRender(decodedImage, qp, frameInfo->content_type);
}
int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame(
const uint64_t pictureId) {
return _receiveCallback->ReceivedDecodedReferenceFrame(pictureId);
}
int32_t VCMDecodedFrameCallback::ReceivedDecodedFrame(
const uint64_t pictureId) {
_lastReceivedPictureID = pictureId;
return 0;
}
uint64_t VCMDecodedFrameCallback::LastReceivedPictureID() const {
return _lastReceivedPictureID;
}
void VCMDecodedFrameCallback::OnDecoderImplementationName(
const char* implementation_name) {
_receiveCallback->OnDecoderImplementationName(implementation_name);
}
void VCMDecodedFrameCallback::Map(uint32_t timestamp,
VCMFrameInformation* frameInfo) {
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::CritScope cs(&lock_);
_timestampMap.Add(timestamp, frameInfo);
}
int32_t VCMDecodedFrameCallback::Pop(uint32_t timestamp) {
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::CritScope cs(&lock_);
if (_timestampMap.Pop(timestamp) == NULL) {
return VCM_GENERAL_ERROR;
}
return VCM_OK;
}
VCMGenericDecoder::VCMGenericDecoder(VideoDecoder* decoder, bool isExternal)
: _callback(NULL),
_frameInfos(),
_nextFrameInfoIdx(0),
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
_decoder(decoder),
_codecType(kVideoCodecUnknown),
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
_isExternal(isExternal),
_keyFrameDecoded(false),
_last_keyframe_content_type(VideoContentType::UNSPECIFIED) {}
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
VCMGenericDecoder::~VCMGenericDecoder() {}
int32_t VCMGenericDecoder::InitDecode(const VideoCodec* settings,
int32_t numberOfCores) {
TRACE_EVENT0("webrtc", "VCMGenericDecoder::InitDecode");
_codecType = settings->codecType;
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
return _decoder->InitDecode(settings, numberOfCores);
}
int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) {
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
TRACE_EVENT1("webrtc", "VCMGenericDecoder::Decode", "timestamp",
frame.EncodedImage()._timeStamp);
_frameInfos[_nextFrameInfoIdx].decodeStartTimeMs = nowMs;
_frameInfos[_nextFrameInfoIdx].renderTimeMs = frame.RenderTimeMs();
_frameInfos[_nextFrameInfoIdx].rotation = frame.rotation();
_frameInfos[_nextFrameInfoIdx].timing = frame.video_timing();
// Set correctly only for key frames. Thus, use latest key frame
// content type. If the corresponding key frame was lost, decode will fail
// and content type will be ignored.
if (frame.FrameType() == kVideoFrameKey) {
_frameInfos[_nextFrameInfoIdx].content_type = frame.contentType();
_last_keyframe_content_type = frame.contentType();
} else {
_frameInfos[_nextFrameInfoIdx].content_type = _last_keyframe_content_type;
}
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
_callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]);
_nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength;
const RTPFragmentationHeader dummy_header;
int32_t ret = _decoder->Decode(frame.EncodedImage(), frame.MissingFrame(),
&dummy_header,
frame.CodecSpecific(), frame.RenderTimeMs());
_callback->OnDecoderImplementationName(_decoder->ImplementationName());
if (ret < WEBRTC_VIDEO_CODEC_OK) {
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
LOG(LS_WARNING) << "Failed to decode frame with timestamp "
<< frame.TimeStamp() << ", error code: " << ret;
_callback->Pop(frame.TimeStamp());
return ret;
} else if (ret == WEBRTC_VIDEO_CODEC_NO_OUTPUT ||
ret == WEBRTC_VIDEO_CODEC_REQUEST_SLI) {
// No output
_callback->Pop(frame.TimeStamp());
}
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
return ret;
}
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 VCMGenericDecoder::Release() {
return _decoder->Release();
}
int32_t VCMGenericDecoder::RegisterDecodeCompleteCallback(
VCMDecodedFrameCallback* callback) {
_callback = 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
return _decoder->RegisterDecodeCompleteCallback(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
bool VCMGenericDecoder::External() const {
return _isExternal;
}
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
bool VCMGenericDecoder::PrefersLateDecoding() const {
return _decoder->PrefersLateDecoding();
}
} // namespace webrtc