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

Unified Diff: media/blink/websourcebuffer_impl.cc

Issue 547223003: MSE: Notify Blink SourceBuffer on init segment received (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits. Plan is to depend on blink-side CL landing first (https://codereview.chromium.org/55294… Created 6 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
Index: media/blink/websourcebuffer_impl.cc
diff --git a/media/blink/websourcebuffer_impl.cc b/media/blink/websourcebuffer_impl.cc
index c87c2b986308e774be00067b27ffa06217c975f8..3491378f2d9f988c6ade4735638ef47b33fcacef 100644
--- a/media/blink/websourcebuffer_impl.cc
+++ b/media/blink/websourcebuffer_impl.cc
@@ -6,8 +6,12 @@
#include <limits>
+#include "base/bind.h"
+#include "base/callback.h"
+#include "base/callback_helpers.h"
#include "base/float_util.h"
#include "media/filters/chunk_demuxer.h"
+#include "third_party/WebKit/public/platform/WebSourceBufferClient.h"
namespace media {
@@ -34,12 +38,20 @@ WebSourceBufferImpl::WebSourceBufferImpl(
const std::string& id, ChunkDemuxer* demuxer)
: id_(id),
demuxer_(demuxer),
+ client_(NULL),
append_window_end_(kInfiniteDuration()) {
DCHECK(demuxer_);
}
WebSourceBufferImpl::~WebSourceBufferImpl() {
DCHECK(!demuxer_) << "Object destroyed w/o removedFromMediaSource() call";
+ DCHECK(!client_);
+}
+
+void WebSourceBufferImpl::setClient(blink::WebSourceBufferClient* client) {
+ DCHECK(client);
+ DCHECK(!client_);
+ client_ = client;
}
bool WebSourceBufferImpl::setMode(WebSourceBuffer::AppendMode mode) {
@@ -76,7 +88,9 @@ void WebSourceBufferImpl::append(
base::TimeDelta old_offset = timestamp_offset_;
demuxer_->AppendData(id_, data, length,
append_window_start_, append_window_end_,
- &timestamp_offset_);
+ &timestamp_offset_,
+ base::Bind(&WebSourceBufferImpl::InitSegmentReceived,
+ base::Unretained(this)));
// Coded frame processing may update the timestamp offset. If the caller
// provides a non-NULL |timestamp_offset| and frame processing changes the
@@ -129,6 +143,12 @@ void WebSourceBufferImpl::setAppendWindowEnd(double end) {
void WebSourceBufferImpl::removedFromMediaSource() {
demuxer_->RemoveId(id_);
demuxer_ = NULL;
+ client_ = NULL;
+}
+
+void WebSourceBufferImpl::InitSegmentReceived() {
+ DVLOG(1) << __FUNCTION__;
+ client_->initializationSegmentReceived();
}
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698