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

Unified Diff: media/base/android/access_unit_queue.cc

Issue 1287423004: MediaCodecPlayer implementation (stage 5 - reconfiguration) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtplayer-cleanuptest
Patch Set: Rebased, removed the wait and check for prerolling in the tests Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/android/access_unit_queue.h ('k') | media/base/android/demuxer_stream_player_params.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/access_unit_queue.cc
diff --git a/media/base/android/access_unit_queue.cc b/media/base/android/access_unit_queue.cc
index 38d45f5468038bf3f6dc263da214edd40c3d402b..151e4aa885fedf6141c4eff5d5f7362dae972872 100644
--- a/media/base/android/access_unit_queue.cc
+++ b/media/base/android/access_unit_queue.cc
@@ -164,7 +164,8 @@ AccessUnitQueue::Info AccessUnitQueue::GetInfo() const {
Info info;
base::AutoLock lock(lock_);
- info.length = GetUnconsumedAccessUnitLength();
+ GetUnconsumedAccessUnitLength(&info.length, &info.data_length);
+
info.has_eos = has_eos_;
info.front_unit = nullptr;
info.configs = nullptr;
@@ -186,14 +187,25 @@ void AccessUnitQueue::SetHistorySizeForTesting(size_t history_chunks_amount) {
history_chunks_amount_ = history_chunks_amount;
}
-int AccessUnitQueue::GetUnconsumedAccessUnitLength() const {
- int result = 0;
+void AccessUnitQueue::GetUnconsumedAccessUnitLength(int* total_length,
liberato (no reviews please) 2015/08/28 15:21:42 it looks like one could do this accounting in push
Tima Vaisburd 2015/08/28 18:31:09 Currently the number of chunks in the normal run i
+ int* data_length) const {
+ *total_length = *data_length = 0;
+
DataChunkQueue::const_iterator chunk;
- for (chunk = current_chunk_; chunk != chunks_.end(); ++chunk)
- result += (*chunk)->access_units.size();
+ for (chunk = current_chunk_; chunk != chunks_.end(); ++chunk) {
+ size_t chunk_size = (*chunk)->access_units.size();
+ *total_length += chunk_size;
+ *data_length += chunk_size;
+
+ // Do not count configuration changes for |data_length|.
+ if (!(*chunk)->demuxer_configs.empty()) {
+ DCHECK((*chunk)->demuxer_configs.size() == 1);
+ --(*data_length);
+ }
+ }
- result -= index_in_chunk_;
- return result;
+ *total_length -= index_in_chunk_;
+ *data_length -= index_in_chunk_;
}
} // namespace media
« no previous file with comments | « media/base/android/access_unit_queue.h ('k') | media/base/android/demuxer_stream_player_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698