Add DecodedImageCallback::Decoded() function with custom decode time value.
On Android, we would like to use MediaCodec output buffers to hold decoded frames until they can be rendered to a texture. There can only be one texture buffer used at the same time and therefore the calculated decode time in VCMTiming will be wrong since that calculation will also include the time where the decoder waited for the upper layers (that depend on network jitter and actual render time) to release the frame. This new method will be used in https://codereview.webrtc.org/1422963003/ BUG=webrtc:4993 R=stefan@webrtc.org TBR=mflodman@webrtc.org Review URL: https://codereview.webrtc.org/1414693006 . Cr-Commit-Position: refs/heads/master@{#10576}
This commit is contained in:
@ -48,6 +48,8 @@ class MockVideoEncoder : public VideoEncoder {
|
||||
class MockDecodedImageCallback : public DecodedImageCallback {
|
||||
public:
|
||||
MOCK_METHOD1(Decoded, int32_t(VideoFrame& decodedImage));
|
||||
MOCK_METHOD2(Decoded, int32_t(VideoFrame& decodedImage,
|
||||
int64_t decode_time_ms));
|
||||
MOCK_METHOD1(ReceivedDecodedReferenceFrame,
|
||||
int32_t(const uint64_t pictureId));
|
||||
MOCK_METHOD1(ReceivedDecodedFrame,
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/common_video/libyuv/include/scaler.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
|
||||
@ -248,6 +249,11 @@ class VideoProcessorImpl : public VideoProcessor {
|
||||
: video_processor_(vp) {
|
||||
}
|
||||
int32_t Decoded(webrtc::VideoFrame& image) override;
|
||||
int32_t Decoded(
|
||||
webrtc::VideoFrame& image, int64_t decode_time_ms) override {
|
||||
RTC_NOTREACHED();
|
||||
return -1;
|
||||
}
|
||||
|
||||
private:
|
||||
VideoProcessorImpl* video_processor_;
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
@ -123,7 +124,7 @@ class Vp8TestDecodedImageCallback : public DecodedImageCallback {
|
||||
Vp8TestDecodedImageCallback()
|
||||
: decoded_frames_(0) {
|
||||
}
|
||||
virtual int32_t Decoded(VideoFrame& decoded_image) {
|
||||
int32_t Decoded(VideoFrame& decoded_image) override {
|
||||
for (int i = 0; i < decoded_image.width(); ++i) {
|
||||
EXPECT_NEAR(kColorY, decoded_image.buffer(kYPlane)[i], 1);
|
||||
}
|
||||
@ -136,6 +137,10 @@ class Vp8TestDecodedImageCallback : public DecodedImageCallback {
|
||||
decoded_frames_++;
|
||||
return 0;
|
||||
}
|
||||
int32_t Decoded(VideoFrame& decoded_image, int64_t decode_time_ms) override {
|
||||
RTC_NOTREACHED();
|
||||
return -1;
|
||||
}
|
||||
int DecodedFrames() {
|
||||
return decoded_frames_;
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
@ -78,7 +79,11 @@ class Vp8UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback {
|
||||
public:
|
||||
explicit Vp8UnitTestDecodeCompleteCallback(VideoFrame* frame)
|
||||
: decoded_frame_(frame), decode_complete(false) {}
|
||||
int Decoded(webrtc::VideoFrame& frame);
|
||||
int32_t Decoded(VideoFrame& frame) override;
|
||||
int32_t Decoded(VideoFrame& frame, int64_t decode_time_ms) override {
|
||||
RTC_NOTREACHED();
|
||||
return -1;
|
||||
}
|
||||
bool DecodeComplete();
|
||||
|
||||
private:
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/common_video/interface/video_image.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
@ -68,7 +69,11 @@ class Vp8SequenceCoderDecodeCallback : public webrtc::DecodedImageCallback {
|
||||
public:
|
||||
explicit Vp8SequenceCoderDecodeCallback(FILE* decoded_file)
|
||||
: decoded_file_(decoded_file) {}
|
||||
int Decoded(webrtc::VideoFrame& frame);
|
||||
int32_t Decoded(webrtc::VideoFrame& frame) override;
|
||||
int32_t Decoded(webrtc::VideoFrame& frame, int64_t decode_time_ms) override {
|
||||
RTC_NOTREACHED();
|
||||
return -1;;
|
||||
}
|
||||
bool DecodeComplete();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user