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

Unified Diff: media/capture/webm_muxer.cc

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 | « media/capture/webm_muxer.h ('k') | media/capture/webm_muxer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/webm_muxer.cc
diff --git a/media/capture/webm_muxer.cc b/media/capture/webm_muxer.cc
index b913fa7501416818c31a857084d225fa66e740d1..c59bbae805293bc02d0463dc9fb37c5f1960756b 100644
--- a/media/capture/webm_muxer.cc
+++ b/media/capture/webm_muxer.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "media/base/limits.h"
#include "media/base/video_frame.h"
+#include "ui/gfx/geometry/size.h"
namespace media {
@@ -34,16 +35,17 @@ WebmMuxer::WebmMuxer(const WriteDataCB& write_data_callback)
}
WebmMuxer::~WebmMuxer() {
- // No need to segment_.Finalize() since is not Seekable(), i.e. a live stream,
- // but is good practice.
+ // No need to segment_.Finalize() since is not Seekable(), i.e. a live
+ // stream, but is a good practice.
+ DCHECK(thread_checker_.CalledOnValidThread());
segment_.Finalize();
}
void WebmMuxer::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) {
- DVLOG(1) << __FUNCTION__ << " - " << encoded_data.size() << "B";
+ DVLOG(1) << __FUNCTION__ << " - " << encoded_data->size() << "B";
DCHECK(thread_checker_.CalledOnValidThread());
if (!track_index_) {
// |track_index_|, cannot be zero (!), initialize WebmMuxer in that case.
@@ -52,8 +54,8 @@ void WebmMuxer::OnEncodedVideo(const scoped_refptr<VideoFrame>& video_frame,
GetFrameRate(video_frame));
first_frame_timestamp_ = timestamp;
}
- segment_.AddFrame(reinterpret_cast<const uint8_t*>(encoded_data.data()),
- encoded_data.size(),
+ segment_.AddFrame(reinterpret_cast<const uint8_t*>(encoded_data->data()),
+ encoded_data->size(),
track_index_,
(timestamp - first_frame_timestamp_).InMicroseconds() *
base::Time::kNanosecondsPerMicrosecond,
@@ -98,7 +100,7 @@ mkvmuxer::int32 WebmMuxer::Write(const void* buf, mkvmuxer::uint32 len) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(buf);
write_data_callback_.Run(base::StringPiece(reinterpret_cast<const char*>(buf),
- len));
+ len));
position_ += len;
return 0;
}
« no previous file with comments | « media/capture/webm_muxer.h ('k') | media/capture/webm_muxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698