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

Side by Side Diff: media/filters/video_renderer_impl.cc

Issue 692323002: Move Liveness from DemuxerStreamProvider to DemuxerStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mojo Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « media/filters/video_renderer_impl.h ('k') | media/filters/video_renderer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/video_renderer_impl.h" 5 #include "media/filters/video_renderer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 DCHECK(!pending_read_); 97 DCHECK(!pending_read_);
98 DCHECK(ready_frames_.empty()); 98 DCHECK(ready_frames_.empty());
99 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING); 99 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING);
100 100
101 state_ = kPlaying; 101 state_ = kPlaying;
102 start_timestamp_ = timestamp; 102 start_timestamp_ = timestamp;
103 AttemptRead_Locked(); 103 AttemptRead_Locked();
104 } 104 }
105 105
106 void VideoRendererImpl::Initialize(DemuxerStream* stream, 106 void VideoRendererImpl::Initialize(DemuxerStream* stream,
107 bool low_delay,
108 const PipelineStatusCB& init_cb, 107 const PipelineStatusCB& init_cb,
109 const StatisticsCB& statistics_cb, 108 const StatisticsCB& statistics_cb,
110 const BufferingStateCB& buffering_state_cb, 109 const BufferingStateCB& buffering_state_cb,
111 const PaintCB& paint_cb, 110 const PaintCB& paint_cb,
112 const base::Closure& ended_cb, 111 const base::Closure& ended_cb,
113 const PipelineStatusCB& error_cb, 112 const PipelineStatusCB& error_cb,
114 const TimeDeltaCB& get_time_cb) { 113 const TimeDeltaCB& get_time_cb) {
115 DCHECK(task_runner_->BelongsToCurrentThread()); 114 DCHECK(task_runner_->BelongsToCurrentThread());
116 base::AutoLock auto_lock(lock_); 115 base::AutoLock auto_lock(lock_);
117 DCHECK(stream); 116 DCHECK(stream);
118 DCHECK_EQ(stream->type(), DemuxerStream::VIDEO); 117 DCHECK_EQ(stream->type(), DemuxerStream::VIDEO);
119 DCHECK(!init_cb.is_null()); 118 DCHECK(!init_cb.is_null());
120 DCHECK(!statistics_cb.is_null()); 119 DCHECK(!statistics_cb.is_null());
121 DCHECK(!buffering_state_cb.is_null()); 120 DCHECK(!buffering_state_cb.is_null());
122 DCHECK(!paint_cb.is_null()); 121 DCHECK(!paint_cb.is_null());
123 DCHECK(!ended_cb.is_null()); 122 DCHECK(!ended_cb.is_null());
124 DCHECK(!get_time_cb.is_null()); 123 DCHECK(!get_time_cb.is_null());
125 DCHECK_EQ(kUninitialized, state_); 124 DCHECK_EQ(kUninitialized, state_);
126 125
127 low_delay_ = low_delay; 126 low_delay_ = (stream->liveness() == DemuxerStream::LIVENESS_LIVE);
128 127
129 // Always post |init_cb_| because |this| could be destroyed if initialization 128 // Always post |init_cb_| because |this| could be destroyed if initialization
130 // failed. 129 // failed.
131 init_cb_ = BindToCurrentLoop(init_cb); 130 init_cb_ = BindToCurrentLoop(init_cb);
132 131
133 statistics_cb_ = statistics_cb; 132 statistics_cb_ = statistics_cb;
134 buffering_state_cb_ = buffering_state_cb; 133 buffering_state_cb_ = buffering_state_cb;
135 paint_cb_ = paint_cb, 134 paint_cb_ = paint_cb,
136 ended_cb_ = ended_cb; 135 ended_cb_ = ended_cb;
137 error_cb_ = error_cb; 136 error_cb_ = error_cb;
138 get_time_cb_ = get_time_cb; 137 get_time_cb_ = get_time_cb;
139 state_ = kInitializing; 138 state_ = kInitializing;
140 139
141 video_frame_stream_->Initialize( 140 video_frame_stream_->Initialize(
142 stream, 141 stream, statistics_cb,
143 low_delay,
144 statistics_cb,
145 base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized, 142 base::Bind(&VideoRendererImpl::OnVideoFrameStreamInitialized,
146 weak_factory_.GetWeakPtr())); 143 weak_factory_.GetWeakPtr()));
147 } 144 }
148 145
149 void VideoRendererImpl::OnVideoFrameStreamInitialized(bool success) { 146 void VideoRendererImpl::OnVideoFrameStreamInitialized(bool success) {
150 DCHECK(task_runner_->BelongsToCurrentThread()); 147 DCHECK(task_runner_->BelongsToCurrentThread());
151 base::AutoLock auto_lock(lock_); 148 base::AutoLock auto_lock(lock_);
152 DCHECK_EQ(state_, kInitializing); 149 DCHECK_EQ(state_, kInitializing);
153 150
154 if (!success) { 151 if (!success) {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics)); 438 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics));
442 439
443 frames_decoded_ = 0; 440 frames_decoded_ = 0;
444 frames_dropped_ = 0; 441 frames_dropped_ = 0;
445 } 442 }
446 443
447 frame_available_.TimedWait(wait_duration); 444 frame_available_.TimedWait(wait_duration);
448 } 445 }
449 446
450 } // namespace media 447 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/video_renderer_impl.h ('k') | media/filters/video_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698