OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/decrypting_video_decoder.h" | 5 #include "media/filters/decrypting_video_decoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 void DecryptingVideoDecoder::Stop(const base::Closure& closure) { | 119 void DecryptingVideoDecoder::Stop(const base::Closure& closure) { |
120 DCHECK(message_loop_->BelongsToCurrentThread()); | 120 DCHECK(message_loop_->BelongsToCurrentThread()); |
121 DVLOG(2) << "Stop() - state: " << state_; | 121 DVLOG(2) << "Stop() - state: " << state_; |
122 | 122 |
123 // At this point the render thread is likely paused (in WebMediaPlayerImpl's | 123 // At this point the render thread is likely paused (in WebMediaPlayerImpl's |
124 // Destroy()), so running |closure| can't wait for anything that requires the | 124 // Destroy()), so running |closure| can't wait for anything that requires the |
125 // render thread to be processing messages to complete (such as PPAPI | 125 // render thread to be processing messages to complete (such as PPAPI |
126 // callbacks). | 126 // callbacks). |
127 if (decryptor_) { | 127 if (decryptor_) { |
128 decryptor_->RegisterKeyAddedCB(Decryptor::kVideo, Decryptor::KeyAddedCB()); | 128 decryptor_->RegisterNewKeyCB(Decryptor::kVideo, Decryptor::NewKeyCB()); |
129 decryptor_->DeinitializeDecoder(Decryptor::kVideo); | 129 decryptor_->DeinitializeDecoder(Decryptor::kVideo); |
130 decryptor_ = NULL; | 130 decryptor_ = NULL; |
131 } | 131 } |
132 if (!set_decryptor_ready_cb_.is_null()) | 132 if (!set_decryptor_ready_cb_.is_null()) |
133 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); | 133 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); |
134 pending_buffer_to_decode_ = NULL; | 134 pending_buffer_to_decode_ = NULL; |
135 if (!init_cb_.is_null()) | 135 if (!init_cb_.is_null()) |
136 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); | 136 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); |
137 if (!read_cb_.is_null()) | 137 if (!read_cb_.is_null()) |
138 base::ResetAndReturn(&read_cb_).Run(kOk, NULL); | 138 base::ResetAndReturn(&read_cb_).Run(kOk, NULL); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 DCHECK(!init_cb_.is_null()); | 180 DCHECK(!init_cb_.is_null()); |
181 DCHECK(reset_cb_.is_null()); // No Reset() before initialization finished. | 181 DCHECK(reset_cb_.is_null()); // No Reset() before initialization finished. |
182 DCHECK(read_cb_.is_null()); // No Read() before initialization finished. | 182 DCHECK(read_cb_.is_null()); // No Read() before initialization finished. |
183 | 183 |
184 if (!success) { | 184 if (!success) { |
185 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); | 185 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); |
186 state_ = kStopped; | 186 state_ = kStopped; |
187 return; | 187 return; |
188 } | 188 } |
189 | 189 |
190 decryptor_->RegisterKeyAddedCB(Decryptor::kVideo, BindToCurrentLoop( | 190 decryptor_->RegisterNewKeyCB(Decryptor::kVideo, BindToCurrentLoop( |
191 base::Bind(&DecryptingVideoDecoder::OnKeyAdded, this))); | 191 base::Bind(&DecryptingVideoDecoder::OnKeyAdded, this))); |
192 | 192 |
193 // Success! | 193 // Success! |
194 state_ = kIdle; | 194 state_ = kIdle; |
195 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); | 195 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); |
196 } | 196 } |
197 | 197 |
198 void DecryptingVideoDecoder::ReadFromDemuxerStream() { | 198 void DecryptingVideoDecoder::ReadFromDemuxerStream() { |
199 DCHECK(message_loop_->BelongsToCurrentThread()); | 199 DCHECK(message_loop_->BelongsToCurrentThread()); |
200 DCHECK_EQ(state_, kPendingDemuxerRead) << state_; | 200 DCHECK_EQ(state_, kPendingDemuxerRead) << state_; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 } | 356 } |
357 | 357 |
358 void DecryptingVideoDecoder::DoReset() { | 358 void DecryptingVideoDecoder::DoReset() { |
359 DCHECK(init_cb_.is_null()); | 359 DCHECK(init_cb_.is_null()); |
360 DCHECK(read_cb_.is_null()); | 360 DCHECK(read_cb_.is_null()); |
361 state_ = kIdle; | 361 state_ = kIdle; |
362 base::ResetAndReturn(&reset_cb_).Run(); | 362 base::ResetAndReturn(&reset_cb_).Run(); |
363 } | 363 } |
364 | 364 |
365 } // namespace media | 365 } // namespace media |
OLD | NEW |