1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/base/pipeline.h"
10 #include "base/callback.h"
11 #include "base/callback_helpers.h"
12 #include "base/command_line.h"
13 #include "base/compiler_specific.h"
14 #include "base/location.h"
15 #include "base/metrics/histogram.h"
16 #include "base/single_thread_task_runner.h"
17 #include "base/stl_util.h"
18 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_util.h"
20 #include "base/synchronization/condition_variable.h"
21 #include "media/base/media_log.h"
22 #include "media/base/media_switches.h"
23 #include "media/base/renderer.h"
24 #include "media/base/text_renderer.h"
25 #include "media/base/text_track_config.h"
26 #include "media/base/video_decoder_config.h"
28 using base::TimeDelta
;
33 const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
,
35 : task_runner_(task_runner
),
36 media_log_(media_log
),
38 did_loading_progress_(false),
43 renderer_ended_(false),
44 text_renderer_ended_(false),
46 pending_cdm_context_(nullptr),
48 media_log_
->AddEvent(media_log_
->CreatePipelineStateChangedEvent(kCreated
));
50 media_log_
->CreateEvent(MediaLogEvent::PIPELINE_CREATED
));
53 Pipeline::~Pipeline() {
54 DCHECK(thread_checker_
.CalledOnValidThread())
55 << "Pipeline must be destroyed on same thread that created it";
56 DCHECK(!running_
) << "Stop() must complete before destroying object";
57 DCHECK(stop_cb_
.is_null());
58 DCHECK(seek_cb_
.is_null());
61 media_log_
->CreateEvent(MediaLogEvent::PIPELINE_DESTROYED
));
64 void Pipeline::Start(Demuxer
* demuxer
,
65 scoped_ptr
<Renderer
> renderer
,
66 const base::Closure
& ended_cb
,
67 const PipelineStatusCB
& error_cb
,
68 const PipelineStatusCB
& seek_cb
,
69 const PipelineMetadataCB
& metadata_cb
,
70 const BufferingStateCB
& buffering_state_cb
,
71 const PaintCB
& paint_cb
,
72 const base::Closure
& duration_change_cb
,
73 const AddTextTrackCB
& add_text_track_cb
,
74 const base::Closure
& waiting_for_decryption_key_cb
) {
75 DCHECK(!ended_cb
.is_null());
76 DCHECK(!error_cb
.is_null());
77 DCHECK(!seek_cb
.is_null());
78 DCHECK(!metadata_cb
.is_null());
79 DCHECK(!buffering_state_cb
.is_null());
80 DCHECK(!paint_cb
.is_null());
82 base::AutoLock
auto_lock(lock_
);
83 CHECK(!running_
) << "Media pipeline is already running";
87 renderer_
= renderer
.Pass();
91 metadata_cb_
= metadata_cb
;
92 buffering_state_cb_
= buffering_state_cb
;
94 duration_change_cb_
= duration_change_cb
;
95 add_text_track_cb_
= add_text_track_cb
;
96 waiting_for_decryption_key_cb_
= waiting_for_decryption_key_cb
;
98 task_runner_
->PostTask(
99 FROM_HERE
, base::Bind(&Pipeline::StartTask
, weak_factory_
.GetWeakPtr()));
102 void Pipeline::Stop(const base::Closure
& stop_cb
) {
103 DVLOG(2) << __FUNCTION__
;
104 task_runner_
->PostTask(
106 base::Bind(&Pipeline::StopTask
, weak_factory_
.GetWeakPtr(), stop_cb
));
109 void Pipeline::Seek(TimeDelta time
, const PipelineStatusCB
& seek_cb
) {
110 base::AutoLock
auto_lock(lock_
);
112 DLOG(ERROR
) << "Media pipeline isn't running. Ignoring Seek().";
116 task_runner_
->PostTask(
119 &Pipeline::SeekTask
, weak_factory_
.GetWeakPtr(), time
, seek_cb
));
122 bool Pipeline::IsRunning() const {
123 base::AutoLock
auto_lock(lock_
);
127 float Pipeline::GetPlaybackRate() const {
128 base::AutoLock
auto_lock(lock_
);
129 return playback_rate_
;
132 void Pipeline::SetPlaybackRate(float playback_rate
) {
133 if (playback_rate
< 0.0f
)
136 base::AutoLock
auto_lock(lock_
);
137 playback_rate_
= playback_rate
;
139 task_runner_
->PostTask(FROM_HERE
,
140 base::Bind(&Pipeline::PlaybackRateChangedTask
,
141 weak_factory_
.GetWeakPtr(),
146 float Pipeline::GetVolume() const {
147 base::AutoLock
auto_lock(lock_
);
151 void Pipeline::SetVolume(float volume
) {
152 if (volume
< 0.0f
|| volume
> 1.0f
)
155 base::AutoLock
auto_lock(lock_
);
158 task_runner_
->PostTask(
161 &Pipeline::VolumeChangedTask
, weak_factory_
.GetWeakPtr(), volume
));
165 TimeDelta
Pipeline::GetMediaTime() const {
166 base::AutoLock
auto_lock(lock_
);
167 return renderer_
? std::min(renderer_
->GetMediaTime(), duration_
)
171 Ranges
<TimeDelta
> Pipeline::GetBufferedTimeRanges() const {
172 base::AutoLock
auto_lock(lock_
);
173 return buffered_time_ranges_
;
176 TimeDelta
Pipeline::GetMediaDuration() const {
177 base::AutoLock
auto_lock(lock_
);
181 bool Pipeline::DidLoadingProgress() {
182 base::AutoLock
auto_lock(lock_
);
183 bool ret
= did_loading_progress_
;
184 did_loading_progress_
= false;
188 PipelineStatistics
Pipeline::GetStatistics() const {
189 base::AutoLock
auto_lock(lock_
);
193 void Pipeline::SetCdm(CdmContext
* cdm_context
,
194 const CdmAttachedCB
& cdm_attached_cb
) {
195 task_runner_
->PostTask(
196 FROM_HERE
, base::Bind(&Pipeline::SetCdmTask
, weak_factory_
.GetWeakPtr(),
197 cdm_context
, cdm_attached_cb
));
200 void Pipeline::SetErrorForTesting(PipelineStatus status
) {
204 bool Pipeline::HasWeakPtrsForTesting() const {
205 DCHECK(task_runner_
->BelongsToCurrentThread());
206 return weak_factory_
.HasWeakPtrs();
209 void Pipeline::SetState(State next_state
) {
210 DVLOG(1) << GetStateString(state_
) << " -> " << GetStateString(next_state
);
213 media_log_
->AddEvent(media_log_
->CreatePipelineStateChangedEvent(next_state
));
216 #define RETURN_STRING(state) case state: return #state;
218 const char* Pipeline::GetStateString(State state
) {
220 RETURN_STRING(kCreated
);
221 RETURN_STRING(kInitDemuxer
);
222 RETURN_STRING(kInitRenderer
);
223 RETURN_STRING(kSeeking
);
224 RETURN_STRING(kPlaying
);
225 RETURN_STRING(kStopping
);
226 RETURN_STRING(kStopped
);
234 Pipeline::State
Pipeline::GetNextState() const {
235 DCHECK(task_runner_
->BelongsToCurrentThread());
236 DCHECK(stop_cb_
.is_null())
237 << "State transitions don't happen when stopping";
238 DCHECK_EQ(status_
, PIPELINE_OK
)
239 << "State transitions don't happen when there's an error: " << status_
;
246 return kInitRenderer
;
257 NOTREACHED() << "State has no transition: " << state_
;
261 void Pipeline::OnDemuxerError(PipelineStatus error
) {
262 task_runner_
->PostTask(FROM_HERE
,
263 base::Bind(&Pipeline::ErrorChangedTask
,
264 weak_factory_
.GetWeakPtr(),
268 void Pipeline::AddTextStream(DemuxerStream
* text_stream
,
269 const TextTrackConfig
& config
) {
270 task_runner_
->PostTask(FROM_HERE
,
271 base::Bind(&Pipeline::AddTextStreamTask
,
272 weak_factory_
.GetWeakPtr(),
277 void Pipeline::RemoveTextStream(DemuxerStream
* text_stream
) {
278 task_runner_
->PostTask(FROM_HERE
,
279 base::Bind(&Pipeline::RemoveTextStreamTask
,
280 weak_factory_
.GetWeakPtr(),
284 void Pipeline::OnError(PipelineStatus error
) {
285 DCHECK(task_runner_
->BelongsToCurrentThread());
287 DCHECK_NE(PIPELINE_OK
, error
);
288 VLOG(1) << "Media pipeline error: " << error
;
290 task_runner_
->PostTask(FROM_HERE
, base::Bind(
291 &Pipeline::ErrorChangedTask
, weak_factory_
.GetWeakPtr(), error
));
294 void Pipeline::SetDuration(TimeDelta duration
) {
296 media_log_
->AddEvent(
297 media_log_
->CreateTimeEvent(
298 MediaLogEvent::DURATION_SET
, "duration", duration
));
299 UMA_HISTOGRAM_LONG_TIMES("Media.Duration", duration
);
301 base::AutoLock
auto_lock(lock_
);
302 duration_
= duration
;
303 if (!duration_change_cb_
.is_null())
304 duration_change_cb_
.Run();
307 void Pipeline::StateTransitionTask(PipelineStatus status
) {
308 DCHECK(task_runner_
->BelongsToCurrentThread());
310 // No-op any state transitions if we're stopping.
311 if (state_
== kStopping
|| state_
== kStopped
)
314 // Preserve existing abnormal status, otherwise update based on the result of
315 // the previous operation.
316 status_
= (status_
!= PIPELINE_OK
? status_
: status
);
318 if (status_
!= PIPELINE_OK
) {
319 ErrorChangedTask(status_
);
323 // Guard against accidentally clearing |pending_callbacks_| for states that
324 // use it as well as states that should not be using it.
325 DCHECK_EQ(pending_callbacks_
.get() != NULL
, state_
== kSeeking
);
327 pending_callbacks_
.reset();
329 PipelineStatusCB done_cb
=
330 base::Bind(&Pipeline::StateTransitionTask
, weak_factory_
.GetWeakPtr());
332 // Switch states, performing any entrance actions for the new state as well.
333 SetState(GetNextState());
336 return InitializeDemuxer(done_cb
);
339 // When the state_ transfers to kInitRenderer, it means the demuxer has
340 // finished parsing the init info. It should call ReportMetadata in case
341 // meeting 'decode' error when passing media segment but WebMediaPlayer's
342 // ready_state_ is still ReadyStateHaveNothing. In that case, it will
343 // treat it as NetworkStateFormatError not NetworkStateDecodeError.
345 start_timestamp_
= demuxer_
->GetStartTime();
347 return InitializeRenderer(done_cb
);
350 DCHECK(start_timestamp_
>= base::TimeDelta());
351 renderer_
->StartPlayingFrom(start_timestamp_
);
354 text_renderer_
->StartPlaying();
356 base::ResetAndReturn(&seek_cb_
).Run(PIPELINE_OK
);
358 PlaybackRateChangedTask(GetPlaybackRate());
359 VolumeChangedTask(GetVolume());
366 NOTREACHED() << "State has no transition: " << state_
;
371 // Note that the usage of base::Unretained() with the renderers is considered
372 // safe as they are owned by |pending_callbacks_| and share the same lifetime.
374 // That being said, deleting the renderers while keeping |pending_callbacks_|
375 // running on the media thread would result in crashes.
376 void Pipeline::DoSeek(TimeDelta seek_timestamp
,
377 const PipelineStatusCB
& done_cb
) {
378 DCHECK(task_runner_
->BelongsToCurrentThread());
379 DCHECK(!pending_callbacks_
.get());
380 DCHECK_EQ(state_
, kSeeking
);
381 SerialRunner::Queue bound_fns
;
384 if (text_renderer_
) {
385 bound_fns
.Push(base::Bind(
386 &TextRenderer::Pause
, base::Unretained(text_renderer_
.get())));
392 base::Bind(&Renderer::Flush
, base::Unretained(renderer_
.get())));
394 if (text_renderer_
) {
395 bound_fns
.Push(base::Bind(
396 &TextRenderer::Flush
, base::Unretained(text_renderer_
.get())));
400 bound_fns
.Push(base::Bind(
401 &Demuxer::Seek
, base::Unretained(demuxer_
), seek_timestamp
));
403 pending_callbacks_
= SerialRunner::Run(bound_fns
, done_cb
);
406 void Pipeline::DoStop(const PipelineStatusCB
& done_cb
) {
407 DVLOG(2) << __FUNCTION__
;
408 DCHECK(task_runner_
->BelongsToCurrentThread());
409 DCHECK(!pending_callbacks_
.get());
411 // TODO(scherkus): Enforce that Renderer is only called on a single thread,
412 // even for accessing media time http://crbug.com/370634
413 scoped_ptr
<Renderer
> renderer
;
415 base::AutoLock
auto_lock(lock_
);
416 renderer
.swap(renderer_
);
419 text_renderer_
.reset();
426 task_runner_
->PostTask(FROM_HERE
, base::Bind(done_cb
, PIPELINE_OK
));
429 void Pipeline::OnStopCompleted(PipelineStatus status
) {
430 DVLOG(2) << __FUNCTION__
;
431 DCHECK(task_runner_
->BelongsToCurrentThread());
432 DCHECK_EQ(state_
, kStopping
);
434 DCHECK(!text_renderer_
);
437 base::AutoLock
auto_lock(lock_
);
444 // If we stop during initialization/seeking we want to run |seek_cb_|
445 // followed by |stop_cb_| so we don't leave outstanding callbacks around.
446 if (!seek_cb_
.is_null()) {
447 base::ResetAndReturn(&seek_cb_
).Run(status_
);
450 if (!stop_cb_
.is_null()) {
453 // Invalid all weak pointers so it's safe to destroy |this| on the render
455 weak_factory_
.InvalidateWeakPtrs();
457 base::ResetAndReturn(&stop_cb_
).Run();
459 // NOTE: pipeline may be deleted at this point in time as a result of
460 // executing |stop_cb_|.
463 if (!error_cb_
.is_null()) {
464 DCHECK_NE(status_
, PIPELINE_OK
);
465 base::ResetAndReturn(&error_cb_
).Run(status_
);
469 void Pipeline::AddBufferedTimeRange(TimeDelta start
, TimeDelta end
) {
471 base::AutoLock
auto_lock(lock_
);
472 buffered_time_ranges_
.Add(start
, end
);
473 did_loading_progress_
= true;
476 // Called from any thread.
477 void Pipeline::OnUpdateStatistics(const PipelineStatistics
& stats
) {
478 base::AutoLock
auto_lock(lock_
);
479 statistics_
.audio_bytes_decoded
+= stats
.audio_bytes_decoded
;
480 statistics_
.video_bytes_decoded
+= stats
.video_bytes_decoded
;
481 statistics_
.video_frames_decoded
+= stats
.video_frames_decoded
;
482 statistics_
.video_frames_dropped
+= stats
.video_frames_dropped
;
485 void Pipeline::StartTask() {
486 DCHECK(task_runner_
->BelongsToCurrentThread());
488 CHECK_EQ(kCreated
, state_
)
489 << "Media pipeline cannot be started more than once";
491 text_renderer_
= CreateTextRenderer();
492 if (text_renderer_
) {
493 text_renderer_
->Initialize(
494 base::Bind(&Pipeline::OnTextRendererEnded
, weak_factory_
.GetWeakPtr()));
497 // Set CDM early to avoid unnecessary delay in Renderer::Initialize().
498 if (pending_cdm_context_
) {
499 renderer_
->SetCdm(pending_cdm_context_
, base::Bind(&IgnoreCdmAttached
));
500 pending_cdm_context_
= nullptr;
503 StateTransitionTask(PIPELINE_OK
);
506 void Pipeline::StopTask(const base::Closure
& stop_cb
) {
507 DCHECK(task_runner_
->BelongsToCurrentThread());
508 DCHECK(stop_cb_
.is_null());
510 if (state_
== kStopped
) {
511 // Invalid all weak pointers so it's safe to destroy |this| on the render
513 weak_factory_
.InvalidateWeakPtrs();
515 // NOTE: pipeline may be deleted at this point in time as a result of
516 // executing |stop_cb|.
524 // We may already be stopping due to a runtime error.
525 if (state_
== kStopping
)
528 // Do not report statistics if the pipeline is not fully initialized.
529 if (state_
== kSeeking
|| state_
== kPlaying
) {
530 PipelineStatistics stats
= GetStatistics();
531 if (renderer_
->HasVideo() && stats
.video_frames_decoded
> 0) {
532 UMA_HISTOGRAM_COUNTS("Media.DroppedFrameCount",
533 stats
.video_frames_dropped
);
538 pending_callbacks_
.reset();
539 DoStop(base::Bind(&Pipeline::OnStopCompleted
, weak_factory_
.GetWeakPtr()));
542 void Pipeline::ErrorChangedTask(PipelineStatus error
) {
543 DCHECK(task_runner_
->BelongsToCurrentThread());
544 DCHECK_NE(PIPELINE_OK
, error
) << "PIPELINE_OK isn't an error!";
546 media_log_
->AddEvent(media_log_
->CreatePipelineErrorEvent(error
));
548 if (state_
== kStopping
|| state_
== kStopped
)
552 pending_callbacks_
.reset();
555 DoStop(base::Bind(&Pipeline::OnStopCompleted
, weak_factory_
.GetWeakPtr()));
558 void Pipeline::PlaybackRateChangedTask(float playback_rate
) {
559 DCHECK(task_runner_
->BelongsToCurrentThread());
561 // Playback rate changes are only carried out while playing.
562 if (state_
!= kPlaying
)
565 renderer_
->SetPlaybackRate(playback_rate
);
568 void Pipeline::VolumeChangedTask(float volume
) {
569 DCHECK(task_runner_
->BelongsToCurrentThread());
571 // Volume changes are only carried out while playing.
572 if (state_
!= kPlaying
)
575 renderer_
->SetVolume(volume
);
578 void Pipeline::SeekTask(TimeDelta time
, const PipelineStatusCB
& seek_cb
) {
579 DCHECK(task_runner_
->BelongsToCurrentThread());
580 DCHECK(stop_cb_
.is_null());
582 // Suppress seeking if we're not fully started.
583 if (state_
!= kPlaying
) {
584 DCHECK(state_
== kStopping
|| state_
== kStopped
)
585 << "Receive extra seek in unexpected state: " << state_
;
587 // TODO(scherkus): should we run the callback? I'm tempted to say the API
588 // will only execute the first Seek() request.
589 DVLOG(1) << "Media pipeline has not started, ignoring seek to "
590 << time
.InMicroseconds() << " (current state: " << state_
<< ")";
594 DCHECK(seek_cb_
.is_null());
596 const base::TimeDelta seek_timestamp
=
597 std::max(time
, demuxer_
->GetStartTime());
601 renderer_ended_
= false;
602 text_renderer_ended_
= false;
603 start_timestamp_
= seek_timestamp
;
605 DoSeek(seek_timestamp
, base::Bind(&Pipeline::StateTransitionTask
,
606 weak_factory_
.GetWeakPtr()));
609 void Pipeline::SetCdmTask(CdmContext
* cdm_context
,
610 const CdmAttachedCB
& cdm_attached_cb
) {
611 base::AutoLock
auto_lock(lock_
);
613 pending_cdm_context_
= cdm_context
;
614 cdm_attached_cb
.Run(true);
618 renderer_
->SetCdm(cdm_context
, cdm_attached_cb
);
621 void Pipeline::OnRendererEnded() {
622 DCHECK(task_runner_
->BelongsToCurrentThread());
623 media_log_
->AddEvent(media_log_
->CreateEvent(MediaLogEvent::ENDED
));
625 if (state_
!= kPlaying
)
628 DCHECK(!renderer_ended_
);
629 renderer_ended_
= true;
631 RunEndedCallbackIfNeeded();
634 void Pipeline::OnTextRendererEnded() {
635 DCHECK(task_runner_
->BelongsToCurrentThread());
636 media_log_
->AddEvent(media_log_
->CreateEvent(MediaLogEvent::TEXT_ENDED
));
638 if (state_
!= kPlaying
)
641 DCHECK(!text_renderer_ended_
);
642 text_renderer_ended_
= true;
644 RunEndedCallbackIfNeeded();
647 void Pipeline::RunEndedCallbackIfNeeded() {
648 DCHECK(task_runner_
->BelongsToCurrentThread());
650 if (renderer_
&& !renderer_ended_
)
653 if (text_renderer_
&& text_renderer_
->HasTracks() && !text_renderer_ended_
)
656 // Correct the duration against current time if it turns out that
657 // the initially reported duration is wrong
658 // TODO(sriram): There are cases where duration is correct and current time
659 // falls short of duration by a few milliseconds. This is a workaround
660 // till we find the actual fix and 250ms is chosen here as it is
661 // the max time between timeupdate events (http://crbug.com/438581).
662 TimeDelta media_time
= renderer_
->GetMediaTime();
663 if ((duration_
- media_time
).InMilliseconds() > 250)
664 SetDuration(media_time
);
666 DCHECK_EQ(status_
, PIPELINE_OK
);
670 scoped_ptr
<TextRenderer
> Pipeline::CreateTextRenderer() {
671 DCHECK(task_runner_
->BelongsToCurrentThread());
673 const base::CommandLine
* cmd_line
= base::CommandLine::ForCurrentProcess();
674 if (!cmd_line
->HasSwitch(switches::kEnableInbandTextTracks
))
675 return scoped_ptr
<media::TextRenderer
>();
677 return scoped_ptr
<media::TextRenderer
>(new media::TextRenderer(
679 base::Bind(&Pipeline::OnAddTextTrack
, weak_factory_
.GetWeakPtr())));
682 void Pipeline::AddTextStreamTask(DemuxerStream
* text_stream
,
683 const TextTrackConfig
& config
) {
684 DCHECK(task_runner_
->BelongsToCurrentThread());
685 // TODO(matthewjheaney): fix up text_ended_ when text stream
686 // is added (http://crbug.com/321446).
688 text_renderer_
->AddTextStream(text_stream
, config
);
691 void Pipeline::RemoveTextStreamTask(DemuxerStream
* text_stream
) {
692 DCHECK(task_runner_
->BelongsToCurrentThread());
694 text_renderer_
->RemoveTextStream(text_stream
);
697 void Pipeline::OnAddTextTrack(const TextTrackConfig
& config
,
698 const AddTextTrackDoneCB
& done_cb
) {
699 DCHECK(task_runner_
->BelongsToCurrentThread());
700 add_text_track_cb_
.Run(config
, done_cb
);
703 void Pipeline::InitializeDemuxer(const PipelineStatusCB
& done_cb
) {
704 DCHECK(task_runner_
->BelongsToCurrentThread());
705 demuxer_
->Initialize(this, done_cb
, text_renderer_
);
708 void Pipeline::InitializeRenderer(const PipelineStatusCB
& done_cb
) {
709 DCHECK(task_runner_
->BelongsToCurrentThread());
711 if (!demuxer_
->GetStream(DemuxerStream::AUDIO
) &&
712 !demuxer_
->GetStream(DemuxerStream::VIDEO
)) {
714 base::AutoLock
auto_lock(lock_
);
717 OnError(PIPELINE_ERROR_COULD_NOT_RENDER
);
721 base::WeakPtr
<Pipeline
> weak_this
= weak_factory_
.GetWeakPtr();
722 renderer_
->Initialize(
725 base::Bind(&Pipeline::OnUpdateStatistics
, weak_this
),
726 base::Bind(&Pipeline::BufferingStateChanged
, weak_this
),
727 base::ResetAndReturn(&paint_cb_
),
728 base::Bind(&Pipeline::OnRendererEnded
, weak_this
),
729 base::Bind(&Pipeline::OnError
, weak_this
),
730 waiting_for_decryption_key_cb_
);
733 void Pipeline::ReportMetadata() {
734 DCHECK(task_runner_
->BelongsToCurrentThread());
735 PipelineMetadata metadata
;
736 metadata
.timeline_offset
= demuxer_
->GetTimelineOffset();
737 DemuxerStream
* stream
= demuxer_
->GetStream(DemuxerStream::VIDEO
);
739 metadata
.has_video
= true;
740 metadata
.natural_size
= stream
->video_decoder_config().natural_size();
741 metadata
.video_rotation
= stream
->video_rotation();
743 if (demuxer_
->GetStream(DemuxerStream::AUDIO
)) {
744 metadata
.has_audio
= true;
746 metadata_cb_
.Run(metadata
);
749 void Pipeline::BufferingStateChanged(BufferingState new_buffering_state
) {
750 DVLOG(1) << __FUNCTION__
<< "(" << new_buffering_state
<< ") ";
751 DCHECK(task_runner_
->BelongsToCurrentThread());
752 buffering_state_cb_
.Run(new_buffering_state
);