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

Issue 1254293003: MediaCodecPlayer implementation (stage 4 - preroll) (Closed)

Created:
5 years, 4 months ago by Tima Vaisburd
Modified:
5 years, 4 months ago
CC:
chromium-reviews, posciak+watch_chromium.org, avayvod+watch_chromium.org, mcasas+watch_chromium.org, feature-media-reviews_chromium.org, wjia+watch_chromium.org, mlamouri+watch-media_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@mtplayer-browserseek
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MediaCodecPlayer implementation (stage 4 - preroll) We request the preroll to be done after seek or when decoder is going to be created anew, i.e. for the first time or after release. The preroll phase is finished when the frame pts becomes equal or greater than the preroll timestamp. After that the decoder suspend itself and reports the state to the player. The player will resume decoders affer all of them are prerolled. The first frame that should be rendered is detected during the preroll phase. For audio we save it on the Java side and pick it up and play when the next frame comes. For video we render such frame during the preroll phase. BUG=407577 Committed: https://crrev.com/17658f61356d6ce6d191f519b0cb13ea31759d0e Cr-Commit-Position: refs/heads/master@{#344949}

Patch Set 1 #

Patch Set 2 : Removed unused var, fixed unit test compilation #

Total comments: 4

Patch Set 3 : Save the first post-preroll audio buffer and replay it when preroll is done #

Total comments: 8

Patch Set 4 : Simplified return from DepleteOutputBuffer() after preroll done #

Patch Set 5 : Moved pending buffer to Java side, preroll after decoder creation and Release() #

Total comments: 2

Patch Set 6 : Added unit test for video-only preroll #

Total comments: 5

Patch Set 7 : Made one pending buffer on Java side instead of an array of buffers #

Patch Set 8 : Added unit tests that check A/V sync after preroll #

Total comments: 2

Patch Set 9 : Enabled multiple start/stop during preroll #

Patch Set 10 : Added a unit test for one stream EOS while prerolling #

Patch Set 11 : Rebased #

Total comments: 24

Patch Set 12 : Addressed Matt's comments #

Total comments: 4

Patch Set 13 : Addressed Frank's comments #

Patch Set 14 : removed unused variable #

Patch Set 15 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+945 lines, -144 lines) Patch
M media/base/android/java/src/org/chromium/media/MediaCodecBridge.java View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +26 lines, -2 lines 0 comments Download
M media/base/android/media_codec_audio_decoder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -1 line 0 comments Download
M media/base/android/media_codec_audio_decoder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +45 lines, -17 lines 0 comments Download
M media/base/android/media_codec_bridge.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +12 lines, -4 lines 0 comments Download
M media/base/android/media_codec_bridge.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +6 lines, -4 lines 0 comments Download
M media/base/android/media_codec_decoder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 9 chunks +49 lines, -12 lines 0 comments Download
M media/base/android/media_codec_decoder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 18 chunks +159 lines, -54 lines 0 comments Download
M media/base/android/media_codec_decoder_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -1 line 0 comments Download
M media/base/android/media_codec_player.h View 1 2 3 4 5 6 7 8 5 chunks +17 lines, -0 lines 0 comments Download
M media/base/android/media_codec_player.cc View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +132 lines, -16 lines 0 comments Download
M media/base/android/media_codec_player_unittest.cc View 1 2 3 4 5 6 7 8 9 10 13 chunks +421 lines, -6 lines 0 comments Download
M media/base/android/media_codec_video_decoder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +6 lines, -4 lines 0 comments Download
M media/base/android/media_codec_video_decoder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 chunks +58 lines, -22 lines 0 comments Download
M media/base/android/test_data_factory.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M media/base/android/test_data_factory.cc View 1 2 3 4 5 6 7 8 9 4 chunks +7 lines, -1 line 0 comments Download

Messages

Total messages: 50 (11 generated)
Tima Vaisburd
Min, this is the preroll. Please take a look. Unit tests are missing for now.
5 years, 4 months ago (2015-07-28 01:21:41 UTC) #2
qinmin
https://codereview.chromium.org/1254293003/diff/20001/media/base/android/media_codec_decoder.cc File media/base/android/media_codec_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/20001/media/base/android/media_codec_decoder.cc#newcode34 media/base/android/media_codec_decoder.cc:34: const int kEstimatedFramePeriod = 20; why we need this ...
5 years, 4 months ago (2015-07-28 18:09:46 UTC) #3
Tima Vaisburd
https://codereview.chromium.org/1254293003/diff/20001/media/base/android/media_codec_decoder.cc File media/base/android/media_codec_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/20001/media/base/android/media_codec_decoder.cc#newcode728 media/base/android/media_codec_decoder.cc:728: const bool do_render = (state == kRunning || state ...
5 years, 4 months ago (2015-07-28 18:34:04 UTC) #4
qinmin
https://codereview.chromium.org/1254293003/diff/20001/media/base/android/media_codec_decoder.cc File media/base/android/media_codec_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/20001/media/base/android/media_codec_decoder.cc#newcode728 media/base/android/media_codec_decoder.cc:728: const bool do_render = (state == kRunning || state ...
5 years, 4 months ago (2015-07-28 18:55:06 UTC) #5
Tima Vaisburd
On 2015/07/28 18:55:06, qinmin wrote: > https://codereview.chromium.org/1254293003/diff/20001/media/base/android/media_codec_decoder.cc > File media/base/android/media_codec_decoder.cc (right): > > https://codereview.chromium.org/1254293003/diff/20001/media/base/android/media_codec_decoder.cc#newcode728 > ...
5 years, 4 months ago (2015-07-28 23:37:14 UTC) #6
qinmin
On 2015/07/28 23:37:14, Tima Vaisburd wrote: > On 2015/07/28 18:55:06, qinmin wrote: > > > ...
5 years, 4 months ago (2015-07-29 18:15:29 UTC) #7
Tima Vaisburd
On 2015/07/29 18:15:29, qinmin wrote: > On 2015/07/28 23:37:14, Tima Vaisburd wrote: > > On ...
5 years, 4 months ago (2015-07-29 18:29:36 UTC) #8
Tima Vaisburd
On 2015/07/29 18:29:36, Tima Vaisburd wrote: > On 2015/07/29 18:15:29, qinmin wrote: > > On ...
5 years, 4 months ago (2015-07-30 18:16:39 UTC) #9
Tima Vaisburd
Rewrote with saving the audio buffer and using it later. It seems to work much ...
5 years, 4 months ago (2015-07-31 01:55:43 UTC) #10
qinmin
https://codereview.chromium.org/1254293003/diff/40001/media/base/android/media_codec_audio_decoder.cc File media/base/android/media_codec_audio_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/40001/media/base/android/media_codec_audio_decoder.cc#newcode193 media/base/android/media_codec_audio_decoder.cc:193: CreatePendingBuffer(buffer_index, size, pts); I prefer we just move the ...
5 years, 4 months ago (2015-07-31 18:43:11 UTC) #11
Tima Vaisburd
https://codereview.chromium.org/1254293003/diff/40001/media/base/android/media_codec_decoder.cc File media/base/android/media_codec_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/40001/media/base/android/media_codec_decoder.cc#newcode279 media/base/android/media_codec_decoder.cc:279: const bool needs_preroll = (preroll_timestamp_ != base::TimeDelta()); On 2015/07/31 ...
5 years, 4 months ago (2015-07-31 19:26:42 UTC) #12
Tima Vaisburd
Min, I moved the pending buffer to the Java side and added a flag to ...
5 years, 4 months ago (2015-08-01 04:34:43 UTC) #13
Tima Vaisburd
Added a unit test. https://codereview.chromium.org/1254293003/diff/100001/media/base/android/media_codec_decoder.cc File media/base/android/media_codec_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/100001/media/base/android/media_codec_decoder.cc#newcode31 media/base/android/media_codec_decoder.cc:31: const int kOutputBufferTimeout = 10; ...
5 years, 4 months ago (2015-08-03 19:44:34 UTC) #14
qinmin
https://codereview.chromium.org/1254293003/diff/100001/media/base/android/media_codec_audio_decoder.cc File media/base/android/media_codec_audio_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/100001/media/base/android/media_codec_audio_decoder.cc#newcode203 media/base/android/media_codec_audio_decoder.cc:203: // MediaCodecBrdge.java only keeps one buffer postponed buffer, but ...
5 years, 4 months ago (2015-08-03 21:25:15 UTC) #15
Tima Vaisburd
https://codereview.chromium.org/1254293003/diff/100001/media/base/android/media_codec_audio_decoder.cc File media/base/android/media_codec_audio_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/100001/media/base/android/media_codec_audio_decoder.cc#newcode203 media/base/android/media_codec_audio_decoder.cc:203: // MediaCodecBrdge.java only keeps one buffer postponed buffer, but ...
5 years, 4 months ago (2015-08-03 22:49:05 UTC) #16
Tima Vaisburd
Matt, please review this CL.
5 years, 4 months ago (2015-08-03 22:49:45 UTC) #18
wolenetz
My apologies for slow review on this. I'll get to this soon (3rd in my ...
5 years, 4 months ago (2015-08-04 21:34:21 UTC) #19
qinmin
https://codereview.chromium.org/1254293003/diff/140001/media/base/android/media_codec_audio_decoder.cc File media/base/android/media_codec_audio_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/140001/media/base/android/media_codec_audio_decoder.cc#newcode204 media/base/android/media_codec_audio_decoder.cc:204: if (frames_to_play < 0) { simply DCHECK_GE(frames_to_play, 0) << ...
5 years, 4 months ago (2015-08-05 18:54:02 UTC) #20
Tima Vaisburd
In order to make preroll work across several stops and resumes during prerolling phase I ...
5 years, 4 months ago (2015-08-06 00:12:37 UTC) #21
qinmin
lgtm
5 years, 4 months ago (2015-08-06 23:18:15 UTC) #22
wolenetz
Thanks Tima for patience. I'll begin my CR iterations today on this.
5 years, 4 months ago (2015-08-17 19:52:50 UTC) #23
wolenetz
Tima, I have a few questions. And to rebalance the CR workload, I'm delegating to ...
5 years, 4 months ago (2015-08-20 20:37:36 UTC) #25
Tima Vaisburd
https://codereview.chromium.org/1254293003/diff/200001/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java File media/base/android/java/src/org/chromium/media/MediaCodecBridge.java (right): https://codereview.chromium.org/1254293003/diff/200001/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java#newcode728 media/base/android/java/src/org/chromium/media/MediaCodecBridge.java:728: * @param buf Audio buffer to be rendered. On ...
5 years, 4 months ago (2015-08-20 22:36:36 UTC) #26
liberato (no reviews please)
mostly nits. https://codereview.chromium.org/1254293003/diff/200001/media/base/android/media_codec_audio_decoder.cc File media/base/android/media_codec_audio_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/200001/media/base/android/media_codec_audio_decoder.cc#newcode77 media/base/android/media_codec_audio_decoder.cc:77: void MediaCodecAudioDecoder::ReleaseMediaCodec() { i don't think that ...
5 years, 4 months ago (2015-08-20 22:54:09 UTC) #27
wolenetz
I'll rubber-stamp qinmin@&&liberato@'s lgtm, without my full review of this. A couple more nits, and ...
5 years, 4 months ago (2015-08-20 23:39:12 UTC) #28
Tima Vaisburd
On 2015/08/20 23:39:12, wolenetz wrote: > In the CL description, I understand it to state ...
5 years, 4 months ago (2015-08-21 00:27:40 UTC) #29
Tima Vaisburd
On 2015/08/21 00:27:40, Tima Vaisburd wrote: > On 2015/08/20 23:39:12, wolenetz wrote: > > In ...
5 years, 4 months ago (2015-08-21 00:31:22 UTC) #30
wolenetz
On 2015/08/21 00:31:22, Tima Vaisburd wrote: > On 2015/08/21 00:27:40, Tima Vaisburd wrote: > > ...
5 years, 4 months ago (2015-08-21 01:28:52 UTC) #31
liberato (no reviews please)
On 2015/08/21 01:28:52, wolenetz wrote: > On 2015/08/21 00:31:22, Tima Vaisburd wrote: > > On ...
5 years, 4 months ago (2015-08-21 15:35:46 UTC) #32
liberato (no reviews please)
On 2015/08/21 01:28:52, wolenetz wrote: > On 2015/08/21 00:31:22, Tima Vaisburd wrote: > > On ...
5 years, 4 months ago (2015-08-21 15:35:47 UTC) #33
Tima Vaisburd
> great explanation! i think that the long version is worth putting into the > ...
5 years, 4 months ago (2015-08-21 20:18:24 UTC) #34
liberato (no reviews please)
lgtm. thanks -fl https://codereview.chromium.org/1254293003/diff/200001/media/base/android/media_codec_decoder.cc File media/base/android/media_codec_decoder.cc (right): https://codereview.chromium.org/1254293003/diff/200001/media/base/android/media_codec_decoder.cc#newcode95 media/base/android/media_codec_decoder.cc:95: ReleaseMediaCodec(); On 2015/08/21 20:18:24, Tima Vaisburd ...
5 years, 4 months ago (2015-08-21 21:02:17 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1254293003/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1254293003/240001
5 years, 4 months ago (2015-08-21 21:29:47 UTC) #38
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_dbg_recipe/builds/111931)
5 years, 4 months ago (2015-08-21 22:22:33 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1254293003/260001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1254293003/260001
5 years, 4 months ago (2015-08-21 22:52:20 UTC) #43
commit-bot: I haz the power
Try jobs failed on following builders: android_compile_dbg on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_compile_dbg/builds/51092)
5 years, 4 months ago (2015-08-21 23:23:37 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1254293003/280001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1254293003/280001
5 years, 4 months ago (2015-08-22 00:53:50 UTC) #48
commit-bot: I haz the power
Committed patchset #15 (id:280001)
5 years, 4 months ago (2015-08-22 01:59:30 UTC) #49
commit-bot: I haz the power
5 years, 4 months ago (2015-08-22 02:00:01 UTC) #50
Message was sent while issue was closed.
Patchset 15 (id:??) landed as
https://crrev.com/17658f61356d6ce6d191f519b0cb13ea31759d0e
Cr-Commit-Position: refs/heads/master@{#344949}

Powered by Google App Engine
This is Rietveld 408576698