Files
platform-external-webrtc/webrtc/video/video_capture_input.h
ivica 8d15bd6dab Reland of Collecting encode_time_ms for each frame (patchset #1 id:1 of https://codereview.webrtc.org/1383283005/ )
Reason for revert:
The reverted commit didn't affect the tests, but the one before: https://codereview.webrtc.org/1385563005/

I've run the test that was failing (EndToEndTest.AssignsTransportSequenceNumbers) locally multiple times, and it works fine (finishes successfully in 150-170ms).

Original issue's description:
> Revert of Collecting encode_time_ms for each frame (patchset #13 id:220001 of https://codereview.webrtc.org/1374233002/ )
>
> Reason for revert:
> Breaks EndToEndTest.AssignsTransportSequenceNumbers in video_engine_tests
> on several bots:
> http://build.chromium.org/p/client.webrtc/builders/Linux64%20Debug/builds/5507
> http://build.chromium.org/p/client.webrtc/builders/Mac64%20Debug/builds/4815
> http://build.chromium.org/p/client.webrtc/builders/Win%20SyzyASan/builds/3272
> http://build.chromium.org/p/client.webrtc/builders/Linux%20Memcheck/builds/4414
>
> It seems very unfortunate that it breaks on _exactly_ the bot configs that aren't covered by the CQ trybots.
>
> Original issue's description:
> > Collecting encode_time_ms for each frame.
> >
> > Also, in Sample struct, replacing double with the original type.
> > It makes more sense to save the original data as truthful as possible, and then
> > convert it to double later if necessary (in the plot script).
> >
> > Committed: https://crrev.com/092b13384e57b33e2003d9736dfa1f491e76f938
> > Cr-Commit-Position: refs/heads/master@{#10184}
>
> TBR=sprang@webrtc.org,pbos@webrtc.org,mflodman@webrtc.org,asapersson@webrtc.org,ivica@webrtc.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://crrev.com/810447972425e890bc7911af27f894b86e9b7e6f
> Cr-Commit-Position: refs/heads/master@{#10185}

TBR=sprang@webrtc.org,pbos@webrtc.org,mflodman@webrtc.org,asapersson@webrtc.org,kjellander@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.webrtc.org/1390163002

Cr-Commit-Position: refs/heads/master@{#10195}
2015-10-07 09:43:25 +00:00

101 lines
3.3 KiB
C++

/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_
#define WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_
#include <vector>
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/common_types.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/video_capture/include/video_capture.h"
#include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
#include "webrtc/modules/video_processing/main/interface/video_processing.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
#include "webrtc/typedefs.h"
#include "webrtc/video_engine/vie_defines.h"
#include "webrtc/video_send_stream.h"
namespace webrtc {
class Config;
class CpuOveruseMetricsObserver;
class CpuOveruseObserver;
class CriticalSectionWrapper;
class EventWrapper;
class OveruseFrameDetector;
class ProcessThread;
class RegistrableCpuOveruseMetricsObserver;
class SendStatisticsProxy;
class VideoRenderer;
class VideoCaptureCallback {
public:
virtual ~VideoCaptureCallback() {}
virtual void DeliverFrame(VideoFrame video_frame) = 0;
};
namespace internal {
class VideoCaptureInput : public webrtc::VideoCaptureInput {
public:
VideoCaptureInput(ProcessThread* module_process_thread,
VideoCaptureCallback* frame_callback,
VideoRenderer* local_renderer,
SendStatisticsProxy* send_stats_proxy,
CpuOveruseObserver* overuse_observer,
EncodingTimeObserver* encoding_time_observer);
~VideoCaptureInput();
void IncomingCapturedFrame(const VideoFrame& video_frame) override;
private:
// Thread functions for deliver captured frames to receivers.
static bool EncoderThreadFunction(void* obj);
bool EncoderProcess();
void DeliverI420Frame(VideoFrame* video_frame);
rtc::scoped_ptr<CriticalSectionWrapper> capture_cs_;
ProcessThread* const module_process_thread_;
VideoCaptureCallback* const frame_callback_;
VideoRenderer* const local_renderer_;
SendStatisticsProxy* const stats_proxy_;
// Frame used in IncomingFrameI420.
rtc::scoped_ptr<CriticalSectionWrapper> incoming_frame_cs_;
VideoFrame incoming_frame_;
rtc::scoped_ptr<ThreadWrapper> encoder_thread_;
rtc::scoped_ptr<EventWrapper> capture_event_;
volatile int stop_;
VideoFrame captured_frame_ GUARDED_BY(capture_cs_.get());
// Used to make sure incoming time stamp is increasing for every frame.
int64_t last_captured_timestamp_;
// Delta used for translating between NTP and internal timestamps.
const int64_t delta_ntp_internal_ms_;
rtc::scoped_ptr<OveruseFrameDetector> overuse_detector_;
EncodingTimeObserver* const encoding_time_observer_;
};
} // namespace internal
} // namespace webrtc
#endif // WEBRTC_VIDEO_VIDEO_CAPTURE_INPUT_H_