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

Unified Diff: media/video/encoded_video_source.h

Issue 16320005: Define EncodedVideoSource and RtcCapturedEncodingVideoCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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/video/encoded_video_source.h
diff --git a/media/video/encoded_video_source.h b/media/video/encoded_video_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..7be3d6b1f65fd8ed31048dcc1de0fccd0db8ae3b
--- /dev/null
+++ b/media/video/encoded_video_source.h
@@ -0,0 +1,111 @@
+// Copyright (c) 2013 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_VIDEO_ENCODED_VIDEO_SOURCE_H_
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 TODO+crbug(m30) for merging this into VEA
hshi1 2013/06/11 00:48:20 Done.
+#define MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_
+
+#include "base/memory/ref_counted.h"
+#include "media/base/encoded_bitstream_buffer.h"
+#include "media/video/video_encode_types.h"
+
+namespace media {
+
+// Class to represent encoded video bitstream.
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 o rly?
hshi1 2013/06/11 19:51:22 Proposed change: remove the entire EVB definition.
+class MEDIA_EXPORT EncodedVideoBitstream :
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 Is it not the case that bitstreams are owned by so
+ public base::RefCountedThreadSafe<EncodedVideoBitstream> {
+ public:
+ class MEDIA_EXPORT Client {
+ public:
+ // After OnStreaming callback stream shall be considered to be streaming.
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 Oh, shall it?? Can you make a pass and cull usele
hshi1 2013/06/11 19:51:22 Got rid of the EVB altogether.
+ virtual void OnBitstreamStreaming(
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 Drop "Bitstream" from the name of each of the func
hshi1 2013/06/11 00:48:20 Made the following changes: OnBitstreamStreaming -
+ scoped_refptr<EncodedVideoBitstream> bitstream,
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 The |bitstream| param to each of these methods is
hshi1 2013/06/11 00:48:20 You're correct; removed.
+ const VideoEncodingParameters& params) = 0;
+
+ // After OnRemoved client has to stop using the bitstream object and
+ // expecting bitstream buffers for that stream. OnRemoved will be called
+ // also in case of any unrecoverable failure in the capturer. After
+ // OnRemoved is called from a stream it is guaranteed that that there will
+ // be no longer pending calls coming in.
+ virtual void OnBitstreamRemoved(
+ scoped_refptr<EncodedVideoBitstream> bitstream) = 0;
+
+ // OnBitstreamReady delivers the captured bitstream buffer by buffer to the
+ // client.
+ virtual void OnBitstreamReady(
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 s/Bitstream/Buffer/
hshi1 2013/06/11 00:48:20 Done.
+ scoped_refptr<EncodedVideoBitstream> bitstream,
+ scoped_refptr<const EncodedBitstreamBuffer> buffer) = 0;
+
+ // OnBitstreamConfigChanged informs about change in bitstream parameters.
+ virtual void OnBitstreamConfigChanged(
+ scoped_refptr<EncodedVideoBitstream> bitstream,
+ const RuntimeVideoEncodingParameters& params) = 0;
+ };
+
+ // TrySetBitstreamConfig issues a reconfiguration request. Old configuration
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 comment out of date (and tortured)
hshi1 2013/06/11 00:48:20 Done.
+ // must be considered to be the valid configuration until
+ // OnBitstreamConfigChanged callback has been issued with value signalling
+ // successful change.
+ virtual void TryConfigure(const RuntimeVideoEncodingParameters& params) = 0;
+
+ protected:
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 Here and elsewhere you seem to think that RCTS<> r
hshi1 2013/06/11 19:51:22 N/A (removed).
+ virtual ~EncodedVideoBitstream() {};
+ friend class base::RefCountedThreadSafe<EncodedVideoBitstream>;
+};
+
+// Class to represent any encoded video source. Anything that provides encoded
+// video can be an EncodedVideoSource. Notable examples of this can be video
+// encoder and webcam that has encoding capability.
+class MEDIA_EXPORT EncodedVideoSource {
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 Is there no need to report errors other than OnBit
hshi1 2013/06/11 00:48:20 Currently no; do you think I should add a separate
+ public:
+
+ class Observer {
+ public:
+ // Invoked when an encoded video source's capabilities become available.
+ virtual void OnCapabilitiesAvailable(EncodedVideoSource* source) = 0;
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 Single-method interfaces are better served by a ca
hshi1 2013/06/11 00:48:20 Removed this caps observer business entirely (see
+
+ protected:
+ virtual ~Observer() {}
+ };
+
+ virtual ~EncodedVideoSource() {};
+
+ // Adds/removes observer to receive OnCapabilitiesAvailable notification.
+ virtual void AddCapabilitiesObserver(Observer* observer) = 0;
+ virtual void RemoveCapabilitiesObserver(Observer* observer) = 0;
+
+ // StartFetchCapabilities initiates an asynchronous query for the types of
+ // encoded bitstream supported by the encoder. When the results become
+ // available, EncodedVideoSource will notify observers via the
+ // OnCapabilitiesAvailable() method.
+ virtual void StartFetchCapabilities() = 0;
+
+ // GetCapabilities informs the client what type of encoded bitstream encoder
+ // is capable to provide. Constraints in the reported capabilities should be
+ // obeyed when configuring bitstreams.
+ virtual VideoEncodingCapability GetCapabilities() = 0;
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 Observer, {Add,Remove}CapabilitiesObserver, StartF
hshi1 2013/06/11 00:48:20 Thanks for the suggestion, I've removed the observ
+
+ // OpenBitstream returns object for the stream being added. Client must
+ // consider the returned stream valid until OnBitstreamRemoved callback is
+ // called with the id. Client should check the parameters agains limits
+ // reported by GetCapabilities before trying to issue an request to add an
+ // encoded bitstream. EncodedVideoSource retains the ownership of
+ // EncodedVideoBitstream and client just has the pointer to it.
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 Again, this comment is craxy.
hshi1 2013/06/11 19:51:22 Now that EVB is gone, I've simplified this to be a
+ virtual scoped_refptr<EncodedVideoBitstream> OpenBitstream(
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 This API was built to support the notion of multip
hshi1 2013/06/11 00:48:20 Talked to sheu@. I'm removing all stream_id and as
+ EncodedVideoBitstream::Client* client,
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 doco lifecycle anytime ownership is not clarified
+ const VideoEncodingParameters& params) = 0;
+ // CloseBitstream removes the bitstream.
+ virtual void CloseBitstream(
+ scoped_refptr<media::EncodedVideoBitstream> bitstream) = 0;
+
+ // ReturnBitstreamBuffer notifies that the data within the buffer has been
+ // processed and it can be reused to encode upcoming bitstream.
+ virtual void ReturnBitstreamBuffer(
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 It's craxy that buffers are handed to EVB::Client
hshi1 2013/06/11 19:51:22 EVB is now gone and EVB::Client is moved to become
+ scoped_refptr<media::EncodedVideoBitstream> bitstream,
+ scoped_refptr<const media::EncodedBitstreamBuffer> buffer) = 0;
+};
+
+} // namespace media
+
+#endif // MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_
+

Powered by Google App Engine
This is Rietveld 408576698