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

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

Issue 1128383003: Implementation of MediaCodecPlayer stage 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused media_codec_player_state.h and .cc Created 5 years, 7 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
Index: media/base/android/access_unit_queue.h
diff --git a/media/base/android/access_unit_queue.h b/media/base/android/access_unit_queue.h
new file mode 100644
index 0000000000000000000000000000000000000000..9c21bba86f25533ed51e826a3746cebde031abb2
--- /dev/null
+++ b/media/base/android/access_unit_queue.h
@@ -0,0 +1,87 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_
+#define MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_
+
+#include <deque>
+
+#include "base/macros.h"
+#include "base/synchronization/lock.h"
+#include "media/base/android/demuxer_stream_player_params.h"
+
+namespace media {
+
+// The queue of incoming data for MediaCodecDecoder.
+//
+// The queue is accessed on the Media thread that puts the incoming
+// data in and the Decoder thread that gets the next access unit and
+// eventually removes it from the queue.
+class AccessUnitQueue {
+ public:
+ // Information about the queue state and it's front AccessUnit
wolenetz 2015/05/19 21:58:37 nit: s/it's/its/
Tima Vaisburd 2015/05/22 23:37:52 Done.
+ struct Info {
+ // The unit at front
+ const AccessUnit* front_unit;
+
+ // New configs at front.
+ // If |front_unit| is defined, |configs| is null, and vice versa.
+ const DemuxerConfigs* configs;
+
+ // Current size of the queue.
wolenetz 2015/05/19 21:58:37 Does presence of new configs change this size?
Tima Vaisburd 2015/05/22 22:48:54 Yes, |kConfigChanged| is a placeholder access unit
+ int length;
+
+ // Whether the queue containd End Of Stream.
+ bool has_eos;
+
+ Info()
+ : front_unit(nullptr), configs(nullptr), length(0), has_eos(false) {}
+ };
+
+ AccessUnitQueue();
+ virtual ~AccessUnitQueue();
wolenetz 2015/05/19 21:58:37 hmm. AccessUnitQueue doesn't derive, nor is it der
Tima Vaisburd 2015/05/22 22:48:54 Sorry, I can't see why it was virtual either. Remo
+
+ // Appends the incoming data to the queue.
+ void PushBack(const DemuxerData& frames);
+
+ // Removes one access unit from the front.
+ void PopFront();
+
+ // Clears the queue
+ void Flush();
+
+ // Looks for the first key frame and if it exists,
+ // removes prior frames and returns true. If it does not
wolenetz 2015/05/19 21:58:37 nit: squeeze 3rd line of comment onto end of 2nd?
Tima Vaisburd 2015/05/22 22:48:54 Done.
+ // exist returns false.
+ bool SkipToKeyFrame();
wolenetz 2015/05/19 21:58:37 What if there is a config prior to the keyframe?
Tima Vaisburd 2015/05/28 02:00:34 As Min pointed out below, instead of going forward
+
+ // Returns the information about the queue.
+ void GetInfo(Info* info) const;
+
+ private:
+ // The queue of access units
+ std::deque<AccessUnit> access_units_;
+
+ // The queue of corresponding configurations.
+ // Some access units has the state set to |kConfigChanged|,
+ // these units have no data and no PTS, and for each there is
wolenetz 2015/05/19 21:58:37 nit ditto: squeeze comment paragraphs into longer
Tima Vaisburd 2015/05/22 22:48:54 Done.
+ // one entry in |demuxer_configs_|
+ std::deque<DemuxerConfigs> demuxer_configs_;
+
+ // Indicates that a unit with End Of Stream flag
+ // has been appended to the queue.
+ bool has_eos_;
+
+ // The queue works on two threads.
+ mutable base::Lock lock_;
+
+ DISALLOW_COPY_AND_ASSIGN(AccessUnitQueue);
+};
+
+} // namespace media
+
+// For logging
+std::ostream& operator<<(std::ostream& os, const media::AccessUnit& au);
wolenetz 2015/05/19 21:58:37 Hmm. Put this into demuxer_stream_player_params.h
Tima Vaisburd 2015/05/22 22:48:54 Done.
+
+#endif // MEDIA_BASE_ANDROID_ACCESS_UNIT_QUEUE_H_

Powered by Google App Engine
This is Rietveld 408576698