webrtc_m130/modules/video_coding/generic_decoder.cc

259 lines
9.7 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 "modules/video_coding/generic_decoder.h"
#include <stddef.h>
#include <algorithm>
#include "api/video/video_timing.h"
#include "modules/video_coding/include/video_error_codes.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/timeutils.h"
#include "rtc_base/trace_event.h"
#include "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 ? absl::optional<int32_t>(decode_time_ms)
: absl::nullopt,
absl::nullopt);
return WEBRTC_VIDEO_CODEC_OK;
}
void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
absl::optional<int32_t> decode_time_ms,
absl::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 "VCMGenericDecoder threading updates for all but Android." This reverts commit a4e71b9e7e59be21b98d63cf8cb676096d9c74b0. Reason for revert: Breaking internal project Original change's description: > VCMGenericDecoder threading updates for all but Android. > > * All methods now have thread checks. > * Variable access associated with thread checkers. > * Remove need for |rtc::CriticalSection lock_| > > Since the android decoder is inherently asynchronous, and > FrameBuffer2's decoder doesn't support posting tasks to it > yet (for async decode completion), we need to tackle android > separately. Once FrameBuffer2 gets changed to use a TaskQueue > or ProcessThread, we can move Android over to delivering decoded > frames on the right thread/queue and delete generic_decoder_android.*. > > Note: This is a subset of code that was previously reviewed here: > - https://codereview.webrtc.org/2764573002/ > > Bug: webrtc:7361, webrtc:8907, chromium:695438 > Change-Id: I118609dfa5c0f0180287d8c2b6d62987b7473c5c > Reviewed-on: https://webrtc-review.googlesource.com/55060 > Commit-Queue: Tommi <tommi@webrtc.org> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#22119} TBR=sakal@webrtc.org,tommi@webrtc.org Change-Id: I3afe4671f9d06bb4a2b17e4f14c21d79f773e067 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7361, webrtc:8907, chromium:695438 Reviewed-on: https://webrtc-review.googlesource.com/56282 Reviewed-by: Lu Liu <lliuu@webrtc.org> Commit-Queue: Lu Liu <lliuu@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22143}
2018-02-21 19:38:59 +00:00
VCMFrameInformation* frameInfo;
{
rtc::CritScope cs(&lock_);
frameInfo = _timestampMap.Pop(decodedImage.timestamp());
}
if (frameInfo == NULL) {
RTC_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 = now_ms - frameInfo->decodeStartTimeMs;
}
_timing->StopDecodeTimer(decodedImage.timestamp(), *decode_time_ms, now_ms,
frameInfo->renderTimeMs);
// Report timing information.
if (frameInfo->timing.flags != VideoSendTiming::kInvalid) {
int64_t capture_time_ms = decodedImage.ntp_time_ms() - ntp_offset_;
// 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_;
int64_t sender_delta_ms = 0;
if (decodedImage.ntp_time_ms() < 0) {
// Sender clock is not estimated yet. Make sure that sender times are all
// negative to indicate that. Yet they still should be relatively correct.
sender_delta_ms =
std::max({capture_time_ms, frameInfo->timing.encode_start_ms,
frameInfo->timing.encode_finish_ms,
frameInfo->timing.packetization_finish_ms,
frameInfo->timing.pacer_exit_ms,
frameInfo->timing.network_timestamp_ms,
frameInfo->timing.network2_timestamp_ms}) +
1;
}
TimingFrameInfo timing_frame_info;
timing_frame_info.capture_time_ms = capture_time_ms - sender_delta_ms;
timing_frame_info.encode_start_ms =
frameInfo->timing.encode_start_ms - sender_delta_ms;
timing_frame_info.encode_finish_ms =
frameInfo->timing.encode_finish_ms - sender_delta_ms;
timing_frame_info.packetization_finish_ms =
frameInfo->timing.packetization_finish_ms - sender_delta_ms;
timing_frame_info.pacer_exit_ms =
frameInfo->timing.pacer_exit_ms - sender_delta_ms;
timing_frame_info.network_timestamp_ms =
frameInfo->timing.network_timestamp_ms - sender_delta_ms;
timing_frame_info.network2_timestamp_ms =
frameInfo->timing.network2_timestamp_ms - sender_delta_ms;
timing_frame_info.receive_start_ms = frameInfo->timing.receive_start_ms;
timing_frame_info.receive_finish_ms = frameInfo->timing.receive_finish_ms;
timing_frame_info.decode_start_ms = frameInfo->decodeStartTimeMs;
timing_frame_info.decode_finish_ms = now_ms;
timing_frame_info.render_time_ms = frameInfo->renderTimeMs;
timing_frame_info.rtp_timestamp = decodedImage.timestamp();
Reland of Add a flags field to video timing extension. (patchset #1 id:1 of https://codereview.webrtc.org/2995953002/ ) Reason for revert: Create reland CL to add fix to. Original issue's description: > Revert of Add a flags field to video timing extension. (patchset #15 id:280001 of https://codereview.webrtc.org/3000753002/ ) > > Reason for revert: > Speculative revet for breaking remoting_unittests in fyi bots. > https://build.chromium.org/p/chromium.webrtc.fyi/waterfall?builder=Win7%20Tester > > Original issue's description: > > Add a flags field to video timing extension. > > > > The rtp header extension for video timing shuold have an additional > > field for signaling metadata, such as what triggered the extension for > > this particular frame. This will allow separating frames select because > > of outlier sizes from regular frames, for more accurate stats. > > > > This implementation is backwards compatible in that it can read video > > timing extensions without the new flag field, but it always sends with > > it included. > > > > BUG=webrtc:7594 > > > > Review-Url: https://codereview.webrtc.org/3000753002 > > Cr-Commit-Position: refs/heads/master@{#19353} > > Committed: https://chromium.googlesource.com/external/webrtc/+/cf5d485e147f7d7b3081692f101e496ce9e1d257 > > TBR=danilchap@webrtc.org,kthelgason@webrtc.org,stefan@webrtc.org,sprang@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:7594 > > Review-Url: https://codereview.webrtc.org/2995953002 > Cr-Commit-Position: refs/heads/master@{#19360} > Committed: https://chromium.googlesource.com/external/webrtc/+/f0f7378b059501bb2bc5d006bf0f43546e47328f TBR=danilchap@webrtc.org,kthelgason@webrtc.org,stefan@webrtc.org,emircan@google.com # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:7594 Review-Url: https://codereview.webrtc.org/2996153002 Cr-Commit-Position: refs/heads/master@{#19405}
2017-08-18 02:51:12 -07:00
timing_frame_info.flags = frameInfo->timing.flags;
_timing->SetTimingFrameInfo(timing_frame_info);
}
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 "VCMGenericDecoder threading updates for all but Android." This reverts commit a4e71b9e7e59be21b98d63cf8cb676096d9c74b0. Reason for revert: Breaking internal project Original change's description: > VCMGenericDecoder threading updates for all but Android. > > * All methods now have thread checks. > * Variable access associated with thread checkers. > * Remove need for |rtc::CriticalSection lock_| > > Since the android decoder is inherently asynchronous, and > FrameBuffer2's decoder doesn't support posting tasks to it > yet (for async decode completion), we need to tackle android > separately. Once FrameBuffer2 gets changed to use a TaskQueue > or ProcessThread, we can move Android over to delivering decoded > frames on the right thread/queue and delete generic_decoder_android.*. > > Note: This is a subset of code that was previously reviewed here: > - https://codereview.webrtc.org/2764573002/ > > Bug: webrtc:7361, webrtc:8907, chromium:695438 > Change-Id: I118609dfa5c0f0180287d8c2b6d62987b7473c5c > Reviewed-on: https://webrtc-review.googlesource.com/55060 > Commit-Queue: Tommi <tommi@webrtc.org> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#22119} TBR=sakal@webrtc.org,tommi@webrtc.org Change-Id: I3afe4671f9d06bb4a2b17e4f14c21d79f773e067 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7361, webrtc:8907, chromium:695438 Reviewed-on: https://webrtc-review.googlesource.com/56282 Reviewed-by: Lu Liu <lliuu@webrtc.org> Commit-Queue: Lu Liu <lliuu@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22143}
2018-02-21 19:38:59 +00:00
rtc::CritScope cs(&lock_);
_timestampMap.Add(timestamp, frameInfo);
}
int32_t VCMDecodedFrameCallback::Pop(uint32_t timestamp) {
Revert "VCMGenericDecoder threading updates for all but Android." This reverts commit a4e71b9e7e59be21b98d63cf8cb676096d9c74b0. Reason for revert: Breaking internal project Original change's description: > VCMGenericDecoder threading updates for all but Android. > > * All methods now have thread checks. > * Variable access associated with thread checkers. > * Remove need for |rtc::CriticalSection lock_| > > Since the android decoder is inherently asynchronous, and > FrameBuffer2's decoder doesn't support posting tasks to it > yet (for async decode completion), we need to tackle android > separately. Once FrameBuffer2 gets changed to use a TaskQueue > or ProcessThread, we can move Android over to delivering decoded > frames on the right thread/queue and delete generic_decoder_android.*. > > Note: This is a subset of code that was previously reviewed here: > - https://codereview.webrtc.org/2764573002/ > > Bug: webrtc:7361, webrtc:8907, chromium:695438 > Change-Id: I118609dfa5c0f0180287d8c2b6d62987b7473c5c > Reviewed-on: https://webrtc-review.googlesource.com/55060 > Commit-Queue: Tommi <tommi@webrtc.org> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#22119} TBR=sakal@webrtc.org,tommi@webrtc.org Change-Id: I3afe4671f9d06bb4a2b17e4f14c21d79f773e067 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7361, webrtc:8907, chromium:695438 Reviewed-on: https://webrtc-review.googlesource.com/56282 Reviewed-by: Lu Liu <lliuu@webrtc.org> Commit-Queue: Lu Liu <lliuu@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22143}
2018-02-21 19:38:59 +00:00
rtc::CritScope cs(&lock_);
if (_timestampMap.Pop(timestamp) == NULL) {
return VCM_GENERAL_ERROR;
}
return VCM_OK;
}
Reland "Update internal SW codecs to return unique_ptrs" This reverts commit 34c8e6bce8af0c31f2b0b31d691a6a931fa3cb7b. Reason for revert: Fix Android compilation Original change's description: > Revert "Update internal SW codecs to return unique_ptrs" > > This reverts commit 4fe6adc06a8524ac25f85260bfe392eb31dae6b4. > > Reason for revert: Breaks android compile. > > Original change's description: > > Update internal SW codecs to return unique_ptrs > > > > TBR=stefan@webrtc.org > > > > Bug: webrtc:7925 > > Change-Id: I84239b071a2608d928f09b06809090eec5eafb14 > > Reviewed-on: https://webrtc-review.googlesource.com/21165 > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#20650} > > TBR=magjed@webrtc.org,sprang@webrtc.org,stefan@webrtc.org > > Change-Id: If33c3a0ee0dfce63d105558a2897a472f0633306 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:7925 > Reviewed-on: https://webrtc-review.googlesource.com/22540 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#20652} TBR=magjed@webrtc.org,sprang@webrtc.org,stefan@webrtc.org Change-Id: Ic8551af4687e927c9b605060155abdd5bc6208b2 Bug: webrtc:7925 Reviewed-on: https://webrtc-review.googlesource.com/22541 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20655}
2017-11-13 14:10:02 +01:00
VCMGenericDecoder::VCMGenericDecoder(std::unique_ptr<VideoDecoder> decoder)
: VCMGenericDecoder(decoder.release(), false /* isExternal */) {}
VCMGenericDecoder::VCMGenericDecoder(VideoDecoder* decoder, bool isExternal)
: _callback(NULL),
_frameInfos(),
_nextFrameInfoIdx(0),
decoder_(decoder),
_codecType(kVideoCodecGeneric),
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),
_last_keyframe_content_type(VideoContentType::UNSPECIFIED) {
RTC_DCHECK(decoder_);
}
VCMGenericDecoder::~VCMGenericDecoder() {
decoder_->Release();
if (_isExternal)
decoder_.release();
RTC_DCHECK(_isExternal || decoder_);
}
int32_t VCMGenericDecoder::InitDecode(const VideoCodec* settings,
int32_t numberOfCores) {
TRACE_EVENT0("webrtc", "VCMGenericDecoder::InitDecode");
_codecType = settings->codecType;
return decoder_->InitDecode(settings, numberOfCores);
}
int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) {
TRACE_EVENT1("webrtc", "VCMGenericDecoder::Decode", "timestamp",
frame.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;
}
_callback->Map(frame.Timestamp(), &_frameInfos[_nextFrameInfoIdx]);
_nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength;
int32_t ret = decoder_->Decode(frame.EncodedImage(), frame.MissingFrame(),
frame.CodecSpecific(), frame.RenderTimeMs());
_callback->OnDecoderImplementationName(decoder_->ImplementationName());
if (ret < WEBRTC_VIDEO_CODEC_OK) {
RTC_LOG(LS_WARNING) << "Failed to decode frame with timestamp "
<< frame.Timestamp() << ", error code: " << ret;
_callback->Pop(frame.Timestamp());
Revert "VCMGenericDecoder threading updates for all but Android." This reverts commit a4e71b9e7e59be21b98d63cf8cb676096d9c74b0. Reason for revert: Breaking internal project Original change's description: > VCMGenericDecoder threading updates for all but Android. > > * All methods now have thread checks. > * Variable access associated with thread checkers. > * Remove need for |rtc::CriticalSection lock_| > > Since the android decoder is inherently asynchronous, and > FrameBuffer2's decoder doesn't support posting tasks to it > yet (for async decode completion), we need to tackle android > separately. Once FrameBuffer2 gets changed to use a TaskQueue > or ProcessThread, we can move Android over to delivering decoded > frames on the right thread/queue and delete generic_decoder_android.*. > > Note: This is a subset of code that was previously reviewed here: > - https://codereview.webrtc.org/2764573002/ > > Bug: webrtc:7361, webrtc:8907, chromium:695438 > Change-Id: I118609dfa5c0f0180287d8c2b6d62987b7473c5c > Reviewed-on: https://webrtc-review.googlesource.com/55060 > Commit-Queue: Tommi <tommi@webrtc.org> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#22119} TBR=sakal@webrtc.org,tommi@webrtc.org Change-Id: I3afe4671f9d06bb4a2b17e4f14c21d79f773e067 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:7361, webrtc:8907, chromium:695438 Reviewed-on: https://webrtc-review.googlesource.com/56282 Reviewed-by: Lu Liu <lliuu@webrtc.org> Commit-Queue: Lu Liu <lliuu@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22143}
2018-02-21 19:38:59 +00:00
return ret;
} else if (ret == WEBRTC_VIDEO_CODEC_NO_OUTPUT) {
// No output
_callback->Pop(frame.Timestamp());
}
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::RegisterDecodeCompleteCallback(
VCMDecodedFrameCallback* callback) {
_callback = callback;
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::PrefersLateDecoding() const {
return decoder_->PrefersLateDecoding();
}
} // namespace webrtc