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

Unified Diff: media/capture/webm_muxer.h

Issue 1351473006: WebmMuxer-MediaRecorderHandler: thread hopping and data ownership (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: StringPiece passed by value Created 5 years, 3 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 | « content/renderer/media/video_track_recorder_unittest.cc ('k') | media/capture/webm_muxer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/webm_muxer.h
diff --git a/media/capture/webm_muxer.h b/media/capture/webm_muxer.h
index 3fec647fa9cc3e8aecb5a53220392e4541eb5376..2d25c46a66a40342f8f2e4484dafee2662bf677e 100644
--- a/media/capture/webm_muxer.h
+++ b/media/capture/webm_muxer.h
@@ -8,14 +8,16 @@
#include <set>
#include "base/callback.h"
-#include "base/gtest_prod_util.h"
#include "base/numerics/safe_math.h"
#include "base/strings/string_piece.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "media/base/media_export.h"
#include "third_party/libwebm/source/mkvmuxer.hpp"
-#include "ui/gfx/geometry/size.h"
+
+namespace gfx {
+class Size;
+} // namespace gfx
namespace media {
@@ -25,29 +27,25 @@ class VideoFrame;
// Matroska container [2], composed of an EBML header, and a single Segment
// including at least a Track Section and a number of SimpleBlocks each
// containing a single encoded video frame. WebM container has no Trailer.
-// Clients will push encoded VPx video frames one by one via the
-// OnEncodedVideo(). libwebm will eventually ping the WriteDataCB passed on
-// contructor with the wrapped encoded data.
-// WebmMuxer is created/destroyed on a thread, usually the Main Render thread,
-// and receives OnEncodedVideo()s on another thread, usually Render IO.
+// Clients will push encoded VPx video frames one by one via OnEncodedVideo().
+// libwebm will eventually ping the WriteDataCB passed on contructor with the
+// wrapped encoded data.
+// WebmMuxer is designed for single thread use throughout.
// [1] http://www.webmproject.org/docs/container/
// [2] http://www.matroska.org/technical/specs/index.html
// TODO(mcasas): Add support for Audio muxing.
class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) {
public:
// Callback to be called when WebmMuxer is ready to write a chunk of data,
- // either any file header or a SingleBlock. The chunk is described as a byte
- // array and a byte length.
- using WriteDataCB = base::Callback<void(const base::StringPiece&)>;
+ // either any file header or a SingleBlock.
+ using WriteDataCB = base::Callback<void(base::StringPiece)>;
explicit WebmMuxer(const WriteDataCB& write_data_callback);
~WebmMuxer() override;
// Adds a |video_frame| with |encoded_data.data()| to WebM Segment.
- // TODO(mcasas): Revisit how |encoded_data| is passed once the whole recording
- // chain is setup (http://crbug.com/262211).
void OnEncodedVideo(const scoped_refptr<VideoFrame>& video_frame,
- const base::StringPiece& encoded_data,
+ scoped_ptr<std::string> encoded_data,
base::TimeTicks timestamp,
bool is_key_frame);
@@ -68,7 +66,7 @@ class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) {
void ElementStartNotify(mkvmuxer::uint64 element_id,
mkvmuxer::int64 position) override;
- // Used to DCHECK that we are called on the correct thread (usually IO)
+ // Used to DCHECK that we are called on the correct thread.
base::ThreadChecker thread_checker_;
// A caller-side identifier to interact with |segment_|, initialised upon
« no previous file with comments | « content/renderer/media/video_track_recorder_unittest.cc ('k') | media/capture/webm_muxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698