Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Issue 3014059: media: recycle buffers/direct rendering etc. (third patch) (Closed)

Created:
10 years, 4 months ago by jiesun
Modified:
9 years, 7 months ago
CC:
chromium-reviews, scherkus (not reviewing), fbarchard, awong, Paweł Hajdan Jr., pam+watch_chromium.org, Alpha Left Google
Visibility:
Public.

Description

media: recycle buffers/direct rendering etc. (third patch) 1. ffmpeg use direct rendering for ogg/h264. webm still do not use direct rendering. for both cases, decoder owns buffers. 2. video renderer change to support flush in a more flexible way. 3. openmax 's both path had been merged and both recycle buffer, 4. finish/fine tune seek logic in openmax code . TEST=test matrix/player_x11/layout test. BUG = None Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=58279

Patch Set 1 : work for desktop #

Patch Set 2 : rc1 #

Patch Set 3 : fix openmax #

Patch Set 4 : rebase #

Patch Set 5 : egl patch #

Total comments: 26

Patch Set 6 : layout #

Total comments: 66

Patch Set 7 : refine state #

Patch Set 8 : clean up #

Patch Set 9 : always decoder own buffers #

Patch Set 10 : rebase #

Total comments: 126

Patch Set 11 : minor change #

Patch Set 12 : code review #

Total comments: 1

Patch Set 13 : add state diagram #

Total comments: 18

Patch Set 14 : address code review issues #

Total comments: 4

Patch Set 15 : code review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+623 lines, -370 lines) Patch
M media/base/limits.h View 10 11 12 13 14 2 chunks +4 lines, -1 line 0 comments Download
M media/filters/ffmpeg_video_allocator.h View 2 3 4 5 6 7 8 9 10 11 12 1 chunk +7 lines, -1 line 0 comments Download
M media/filters/ffmpeg_video_decode_engine.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +31 lines, -0 lines 0 comments Download
M media/filters/ffmpeg_video_decode_engine.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 7 chunks +130 lines, -29 lines 0 comments Download
M media/filters/ffmpeg_video_decoder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +11 lines, -6 lines 0 comments Download
M media/filters/ffmpeg_video_decoder.cc View 1 2 3 4 5 6 7 8 9 10 11 13 chunks +61 lines, -39 lines 0 comments Download
M media/filters/omx_video_decode_engine.h View 1 2 3 4 7 chunks +11 lines, -20 lines 0 comments Download
M media/filters/omx_video_decode_engine.cc View 1 2 3 4 5 6 7 8 9 10 31 chunks +183 lines, -160 lines 0 comments Download
M media/filters/video_renderer_base.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +36 lines, -6 lines 0 comments Download
M media/filters/video_renderer_base.cc View 1 2 3 4 5 6 7 8 9 10 11 16 chunks +122 lines, -100 lines 0 comments Download
M media/filters/video_renderer_base_unittest.cc View 4 chunks +26 lines, -7 lines 0 comments Download
M media/tools/player_x11/gles_video_renderer.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 15 (0 generated)
jiesun
please have a look.
10 years, 4 months ago (2010-08-18 18:19:39 UTC) #1
Alpha Left Google
I'm reviewing this patch now.
10 years, 4 months ago (2010-08-20 23:31:49 UTC) #2
Alpha Left Google
I haven't looked into decoders and renderers yet but I'm sending my comments on pipeline ...
10 years, 4 months ago (2010-08-21 00:08:39 UTC) #3
jiesun
code review concerns fixed. PipelineImpl() 's unittest did cover Stop(), I did not change the ...
10 years, 4 months ago (2010-08-23 16:46:08 UTC) #4
Alpha Left Google
http://codereview.chromium.org/3014059/diff/8002/41006 File media/filters/ffmpeg_video_allocator.h (left): http://codereview.chromium.org/3014059/diff/8002/41006#oldcode30 media/filters/ffmpeg_video_allocator.h:30: ~RefCountedAVFrame() { DCHECK_EQ(usage_count_, 0); } I understand the reason ...
10 years, 4 months ago (2010-08-23 21:17:53 UTC) #5
jiesun
PHAL http://codereview.chromium.org/3014059/diff/8002/41006 File media/filters/ffmpeg_video_allocator.h (left): http://codereview.chromium.org/3014059/diff/8002/41006#oldcode30 media/filters/ffmpeg_video_allocator.h:30: ~RefCountedAVFrame() { DCHECK_EQ(usage_count_, 0); } Ideally we can ...
10 years, 4 months ago (2010-08-25 23:19:04 UTC) #6
jiesun
update all the path to use decoder as owner. add some annotation to the changed ...
10 years, 4 months ago (2010-08-27 00:09:27 UTC) #7
Alpha Left Google
Looking pretty good to me. My biggest suggestion is to comment the code using your ...
10 years, 3 months ago (2010-08-27 23:41:31 UTC) #8
jiesun
PHAL. 1. move the annotation to comments. 2. add state diagram. 3. rebase. http://codereview.chromium.org/3014059/diff/68001/38004 File ...
10 years, 3 months ago (2010-08-30 20:14:56 UTC) #9
Alpha Left Google
LGTM. http://codereview.chromium.org/3014059/diff/68001/38008 File media/filters/ffmpeg_video_decoder.cc (right): http://codereview.chromium.org/3014059/diff/68001/38008#newcode327 media/filters/ffmpeg_video_decoder.cc:327: frame_queue_flushed_.push_back(video_frame); On 2010/08/30 20:14:56, jiesun wrote: > I ...
10 years, 3 months ago (2010-08-30 22:41:31 UTC) #10
jiesun
I had been trying very hard to match the interface with pepper video interface. (with ...
10 years, 3 months ago (2010-08-30 23:09:29 UTC) #11
Alpha Left Google
I don't think anyone is doing the prerolling for ipc_video_decoder except me hooking it up ...
10 years, 3 months ago (2010-08-30 23:17:21 UTC) #12
scherkus (not reviewing)
http://codereview.chromium.org/3014059/diff/87001/88001 File media/base/limits.h (right): http://codereview.chromium.org/3014059/diff/87001/88001#newcode1 media/base/limits.h:1: // Copyright (c) 2009 The Chromium Authors. All rights ...
10 years, 3 months ago (2010-08-31 02:43:02 UTC) #13
jiesun
thanks for reviews. I add some comments, PHAL. http://codereview.chromium.org/3014059/diff/87001/88001 File media/base/limits.h (right): http://codereview.chromium.org/3014059/diff/87001/88001#newcode1 media/base/limits.h:1: // ...
10 years, 3 months ago (2010-08-31 17:36:52 UTC) #14
scherkus (not reviewing)
10 years, 3 months ago (2010-09-01 04:27:16 UTC) #15
LGTM w/ nits

I'll have to dive in a clean up the pipeline/filter relationship at some point
(might be doing this next week as part of 20%)

http://codereview.chromium.org/3014059/diff/87001/88009
File media/filters/video_renderer_base.cc (right):

http://codereview.chromium.org/3014059/diff/87001/88009#newcode135
media/filters/video_renderer_base.cc:135: // There is a race condition between
filters to receive SeekTask().
On 2010/08/31 17:36:52, jiesun wrote:
> Good question!
> I had thought some solution for this. neither one is ideal.
> Because we serialize Seek in pipeline and we perform all operation from upper
> stream to down stream ( except flush is parallel now). the last filter receive
> the Seek() is renderer. "Preroll" (scheduling some buffer exchange) is where
> pipeline are starting to populate with buffers. If renderer start preroll, we
> are sure in this point every filters receive Seek(). that's how current code
> works.
> The problem is that we need to decouple two concepts 
> 1. the request to preroll 
> 2. buffer pool availability. 
> We use 1 to resolve the start/stop/seek race condition during state change. we
> use 2 to mark display had been done and correctly recycle buffers.
> We use both to flow control.
> We use a single interface to achieve both.
> So In my patch, I removed 1 as a method of flow control. use 2 as single flow
> control method. let decoder to "preroll" which causing the problem. 
> 
> 1. One way to resolve this could be seperate interface for (1)/(2). say: after
> last filter received seek() it call it upstreams Preroll() to start. 
> 2. Another hacky way is use empty frame request as flow control, discount them
> when maintaining the buffer count. flow control will be a little complex,
> because we use both requests and buffer availabilities to control it. these
> parameters(buffer count vs request count) are potential different because it
> comes from different filters, making it necessary to queue both and match each
> other, which is not clean. (but doable)
> 3. More complex way (from this pipeline) is illustrate here
> http://msdn.microsoft.com/en-us/library/ms783675.aspx. If we let demux to
> preroll. (A push model) and reverse the Seek/Start order, ( from renderer to
> demuxer) , then we are gurantee no buffer exchange before demuxer start to
> preroll.
> Audio path is not working this way, therefore I do not think it is an option
for
> me. This way, we drop all the request model, and use buffer available as
single
> way to control flow.
> 
> how do you think?

hrmm sounds like something we'll have to clean up later

could you file a bug that includes this summary + link to it from this code? 
this is some good insight we should keep track of

http://codereview.chromium.org/3014059/diff/102001/103003
File media/filters/ffmpeg_video_decode_engine.cc (right):

http://codereview.chromium.org/3014059/diff/102001/103003#newcode158
media/filters/ffmpeg_video_decode_engine.cc:158: TryToFinishPendingFlush();  //
Try to finish flushing and notify pipeline.
nit: remove this comment -- reason why we went with the new name :)

http://codereview.chromium.org/3014059/diff/102001/103003#newcode179
media/filters/ffmpeg_video_decode_engine.cc:179: TryToFinishPendingFlush();  //
Try to finish flushing and notify pipeline.
ditto

http://codereview.chromium.org/3014059/diff/102001/103003#newcode307
media/filters/ffmpeg_video_decode_engine.cc:307: TryToFinishPendingFlush();  //
Try to finish flushing and notify pipeline.
ditto

http://codereview.chromium.org/3014059/diff/102001/103003#newcode310
media/filters/ffmpeg_video_decode_engine.cc:310: bool
FFmpegVideoDecodeEngine::TryToFinishPendingFlush() {
actually I'm sorry.. I wrote that comment without fully thinking this through

could you make this void?  it looks like the return value will never be used so
might as well not confuse other people

Powered by Google App Engine
This is Rietveld 408576698