diff options
Diffstat (limited to 'media')
-rw-r--r-- | media/base/filters.h | 3 | ||||
-rw-r--r-- | media/base/mock_filters.h | 1 | ||||
-rw-r--r-- | media/filters/ffmpeg_video_decoder.cc | 24 | ||||
-rw-r--r-- | media/filters/ffmpeg_video_decoder.h | 36 | ||||
-rw-r--r-- | media/filters/ffmpeg_video_decoder_unittest.cc | 5 | ||||
-rw-r--r-- | media/filters/video_renderer_base.cc | 13 | ||||
-rw-r--r-- | media/filters/video_renderer_base_unittest.cc | 3 | ||||
-rw-r--r-- | media/video/ffmpeg_video_decode_engine.cc | 6 | ||||
-rw-r--r-- | media/video/ffmpeg_video_decode_engine_unittest.cc | 1 | ||||
-rw-r--r-- | media/video/video_decode_engine.h | 19 |
10 files changed, 33 insertions, 78 deletions
diff --git a/media/base/filters.h b/media/base/filters.h index f9b162c..1ce8682 100644 --- a/media/base/filters.h +++ b/media/base/filters.h @@ -218,9 +218,6 @@ class VideoDecoder : public Filter { consume_video_frame_callback_ = callback; } - // Indicate whether decoder provides its own output buffers - virtual bool ProvidesBuffer() = 0; - // Returns the width and height of decoded video in pixels. // // Clients should NOT rely on these values to remain constant. Instead, use diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h index 6abb9db..635659e 100644 --- a/media/base/mock_filters.h +++ b/media/base/mock_filters.h @@ -182,7 +182,6 @@ class MockVideoDecoder : public VideoDecoder { FilterCallback* callback, StatisticsCallback* stats_callback)); MOCK_METHOD1(ProduceVideoFrame, void(scoped_refptr<VideoFrame>)); - MOCK_METHOD0(ProvidesBuffer, bool()); MOCK_METHOD0(width, int()); MOCK_METHOD0(height, int()); diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc index c6409ba..e1aea55 100644 --- a/media/filters/ffmpeg_video_decoder.cc +++ b/media/filters/ffmpeg_video_decoder.cc @@ -28,8 +28,7 @@ FFmpegVideoDecoder::FFmpegVideoDecoder(MessageLoop* message_loop, memset(&info_, 0, sizeof(info_)); } -FFmpegVideoDecoder::~FFmpegVideoDecoder() { -} +FFmpegVideoDecoder::~FFmpegVideoDecoder() {} void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream, FilterCallback* callback, @@ -203,10 +202,6 @@ void FFmpegVideoDecoder::OnError() { VideoFrameReady(NULL); } -void FFmpegVideoDecoder::OnFormatChange(VideoStreamInfo stream_info) { - NOTIMPLEMENTED(); -} - void FFmpegVideoDecoder::OnReadComplete(Buffer* buffer_in) { scoped_refptr<Buffer> buffer(buffer_in); message_loop_->PostTask( @@ -335,19 +330,14 @@ void FFmpegVideoDecoder::ProduceVideoSample( this)); } -bool FFmpegVideoDecoder::ProvidesBuffer() { - DCHECK(info_.success); - return info_.provides_buffers; -} - int FFmpegVideoDecoder::width() { DCHECK(info_.success); - return info_.stream_info.surface_width; + return info_.surface_width; } int FFmpegVideoDecoder::height() { DCHECK(info_.success); - return info_.stream_info.surface_height; + return info_.surface_height; } void FFmpegVideoDecoder::FlushBuffers() { @@ -356,12 +346,8 @@ void FFmpegVideoDecoder::FlushBuffers() { video_frame = frame_queue_flushed_.front(); frame_queue_flushed_.pop_front(); - // Depends on who own the buffers, we either return it to the renderer - // or return it to the decode engine. - if (ProvidesBuffer()) - decode_engine_->ProduceVideoFrame(video_frame); - else - VideoFrameReady(video_frame); + // Return frames back to the decode engine. + decode_engine_->ProduceVideoFrame(video_frame); } } diff --git a/media/filters/ffmpeg_video_decoder.h b/media/filters/ffmpeg_video_decoder.h index 5324bf2..fbf6210 100644 --- a/media/filters/ffmpeg_video_decoder.h +++ b/media/filters/ffmpeg_video_decoder.h @@ -28,31 +28,31 @@ class FFmpegVideoDecoder virtual ~FFmpegVideoDecoder(); // Filter implementation. - virtual void Stop(FilterCallback* callback); - virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb); - virtual void Pause(FilterCallback* callback); - virtual void Flush(FilterCallback* callback); + virtual void Stop(FilterCallback* callback) OVERRIDE; + virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE; + virtual void Pause(FilterCallback* callback) OVERRIDE; + virtual void Flush(FilterCallback* callback) OVERRIDE; // Decoder implementation. virtual void Initialize(DemuxerStream* demuxer_stream, FilterCallback* callback, - StatisticsCallback* stats_callback); - virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> video_frame); - virtual bool ProvidesBuffer(); - virtual int width(); - virtual int height(); + StatisticsCallback* stats_callback) OVERRIDE; + virtual void ProduceVideoFrame( + scoped_refptr<VideoFrame> video_frame) OVERRIDE; + virtual int width() OVERRIDE; + virtual int height() OVERRIDE; private: // VideoDecodeEngine::EventHandler interface. - virtual void OnInitializeComplete(const VideoCodecInfo& info); - virtual void OnUninitializeComplete(); - virtual void OnFlushComplete(); - virtual void OnSeekComplete(); - virtual void OnError(); - virtual void OnFormatChange(VideoStreamInfo stream_info); - virtual void ProduceVideoSample(scoped_refptr<Buffer> buffer); - virtual void ConsumeVideoFrame(scoped_refptr<VideoFrame> frame, - const PipelineStatistics& statistics); + virtual void OnInitializeComplete(const VideoCodecInfo& info) OVERRIDE; + virtual void OnUninitializeComplete() OVERRIDE; + virtual void OnFlushComplete() OVERRIDE; + virtual void OnSeekComplete() OVERRIDE; + virtual void OnError() OVERRIDE; + virtual void ProduceVideoSample(scoped_refptr<Buffer> buffer) OVERRIDE; + virtual void ConsumeVideoFrame( + scoped_refptr<VideoFrame> frame, + const PipelineStatistics& statistics) OVERRIDE; friend class DecoderPrivateMock; friend class FFmpegVideoDecoderTest; diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc index 7aafaac..7614d8b 100644 --- a/media/filters/ffmpeg_video_decoder_unittest.cc +++ b/media/filters/ffmpeg_video_decoder_unittest.cc @@ -111,9 +111,8 @@ class DecoderPrivateMock : public FFmpegVideoDecoder { ACTION_P2(EngineInitialize, engine, success) { engine->event_handler_ = arg1; engine->info_.success = success; - engine->info_.stream_info.surface_format = VideoFrame::YV12; - engine->info_.stream_info.surface_width = kWidth; - engine->info_.stream_info.surface_height = kHeight; + engine->info_.surface_width = kWidth; + engine->info_.surface_height = kHeight; engine->event_handler_->OnInitializeComplete(engine->info_); } diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc index 94e1bdf..ce94d33 100644 --- a/media/filters/video_renderer_base.cc +++ b/media/filters/video_renderer_base.cc @@ -486,10 +486,8 @@ void VideoRendererBase::FlushBuffers() { } current_frame_ = NULL; - if (decoder_->ProvidesBuffer()) { - // Flush all buffers out to decoder; - ScheduleRead_Locked(); - } + // Flush all buffers out to decoder. + ScheduleRead_Locked(); if (pending_reads_ == 0 && state_ == kFlushing) OnFlushDone(); @@ -497,12 +495,7 @@ void VideoRendererBase::FlushBuffers() { void VideoRendererBase::OnFlushDone() { // Check all buffers are return to owners. - if (decoder_->ProvidesBuffer()) { - DCHECK_EQ(frames_queue_done_.size(), 0u); - } else { - DCHECK_EQ(frames_queue_done_.size(), - static_cast<size_t>(Limits::kMaxVideoFrames)); - } + DCHECK_EQ(frames_queue_done_.size(), 0u); DCHECK(!current_frame_.get()); DCHECK(frames_queue_ready_.empty()); diff --git a/media/filters/video_renderer_base_unittest.cc b/media/filters/video_renderer_base_unittest.cc index 6ed126f..ccef901 100644 --- a/media/filters/video_renderer_base_unittest.cc +++ b/media/filters/video_renderer_base_unittest.cc @@ -58,9 +58,6 @@ class VideoRendererBaseTest : public ::testing::Test { EXPECT_CALL(*decoder_, ProduceVideoFrame(_)) .WillRepeatedly(Invoke(this, &VideoRendererBaseTest::EnqueueCallback)); - EXPECT_CALL(*decoder_, ProvidesBuffer()) - .WillRepeatedly(Return(true)); - EXPECT_CALL(*decoder_, width()).WillRepeatedly(Return(kWidth)); EXPECT_CALL(*decoder_, height()).WillRepeatedly(Return(kHeight)); diff --git a/media/video/ffmpeg_video_decode_engine.cc b/media/video/ffmpeg_video_decode_engine.cc index 51522c5..4af73a1 100644 --- a/media/video/ffmpeg_video_decode_engine.cc +++ b/media/video/ffmpeg_video_decode_engine.cc @@ -104,10 +104,8 @@ void FFmpegVideoDecodeEngine::Initialize( av_frame_.reset(avcodec_alloc_frame()); VideoCodecInfo info; info.success = false; - info.provides_buffers = true; - info.stream_info.surface_format = GetSurfaceFormat(); - info.stream_info.surface_width = config.surface_width(); - info.stream_info.surface_height = config.surface_height(); + info.surface_width = config.surface_width(); + info.surface_height = config.surface_height(); // If we do not have enough buffers, we will report error too. frame_queue_available_.clear(); diff --git a/media/video/ffmpeg_video_decode_engine_unittest.cc b/media/video/ffmpeg_video_decode_engine_unittest.cc index 01016d4..261ca45 100644 --- a/media/video/ffmpeg_video_decode_engine_unittest.cc +++ b/media/video/ffmpeg_video_decode_engine_unittest.cc @@ -134,7 +134,6 @@ class FFmpegVideoDecodeEngineTest MOCK_METHOD0(OnFlushComplete, void()); MOCK_METHOD0(OnSeekComplete, void()); MOCK_METHOD0(OnError, void()); - MOCK_METHOD1(OnFormatChange, void(VideoStreamInfo stream_info)); // Used by gmock actions. void set_video_frame(scoped_refptr<VideoFrame> video_frame) { diff --git a/media/video/video_decode_engine.h b/media/video/video_decode_engine.h index 2cefc44..fb6933d 100644 --- a/media/video/video_decode_engine.h +++ b/media/video/video_decode_engine.h @@ -19,8 +19,9 @@ class VideoDecodeContext; struct PipelineStatistics; -struct VideoStreamInfo { - VideoFrame::Format surface_format; +struct VideoCodecInfo { + // Other parameter is only meaningful when this is true. + bool success; // Can be different with container's value. uint32 surface_width; @@ -29,19 +30,6 @@ struct VideoStreamInfo { uint32 surface_height; }; -struct VideoCodecInfo { - // Other parameter is only meaningful when this is true. - bool success; - - // Whether decoder provides output buffer pool. - // TODO(hclam): This is not important anymore. Remove this. - bool provides_buffers; - - // Initial Stream Info. Only part of them could be valid. - // If they are not valid, Engine should update with OnFormatChange. - VideoStreamInfo stream_info; -}; - class VideoDecodeEngine { public: struct EventHandler { @@ -52,7 +40,6 @@ class VideoDecodeEngine { virtual void OnFlushComplete() = 0; virtual void OnSeekComplete() = 0; virtual void OnError() = 0; - virtual void OnFormatChange(VideoStreamInfo stream_info) = 0; // TODO(hclam): The following two methods shouldn't belong to this class // because they are not video decode events but used to send decoded |