| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cast/sender/h264_vt_encoder.h" | 5 #include "media/cast/sender/h264_vt_encoder.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 // If the compression session exists, invalidate it. This blocks until all | 355 // If the compression session exists, invalidate it. This blocks until all |
| 356 // pending output callbacks have returned and any internal threads have | 356 // pending output callbacks have returned and any internal threads have |
| 357 // joined, ensuring no output callback ever sees a dangling encoder pointer. | 357 // joined, ensuring no output callback ever sees a dangling encoder pointer. |
| 358 if (compression_session_) { | 358 if (compression_session_) { |
| 359 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_); | 359 videotoolbox_glue_->VTCompressionSessionInvalidate(compression_session_); |
| 360 compression_session_.reset(); | 360 compression_session_.reset(); |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| 364 bool H264VideoToolboxEncoder::CanEncodeVariedFrameSizes() const { |
| 365 return false; |
| 366 } |
| 367 |
| 364 bool H264VideoToolboxEncoder::EncodeVideoFrame( | 368 bool H264VideoToolboxEncoder::EncodeVideoFrame( |
| 365 const scoped_refptr<media::VideoFrame>& video_frame, | 369 const scoped_refptr<media::VideoFrame>& video_frame, |
| 366 const base::TimeTicks& reference_time, | 370 const base::TimeTicks& reference_time, |
| 367 const FrameEncodedCallback& frame_encoded_callback) { | 371 const FrameEncodedCallback& frame_encoded_callback) { |
| 368 DCHECK(thread_checker_.CalledOnValidThread()); | 372 DCHECK(thread_checker_.CalledOnValidThread()); |
| 369 DCHECK(!video_frame->visible_rect().IsEmpty()); | 373 DCHECK(!video_frame->visible_rect().IsEmpty()); |
| 370 DCHECK(!frame_encoded_callback.is_null()); | 374 DCHECK(!frame_encoded_callback.is_null()); |
| 371 | 375 |
| 372 if (!compression_session_) { | 376 if (!compression_session_) { |
| 373 DLOG(ERROR) << " compression session is null"; | 377 DLOG(ERROR) << " compression session is null"; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 CopySampleBufferToAnnexBBuffer(sbuf, &encoded_frame->data, keyframe); | 537 CopySampleBufferToAnnexBBuffer(sbuf, &encoded_frame->data, keyframe); |
| 534 | 538 |
| 535 encoder->cast_environment_->PostTask( | 539 encoder->cast_environment_->PostTask( |
| 536 CastEnvironment::MAIN, FROM_HERE, | 540 CastEnvironment::MAIN, FROM_HERE, |
| 537 base::Bind(request->frame_encoded_callback, | 541 base::Bind(request->frame_encoded_callback, |
| 538 base::Passed(&encoded_frame))); | 542 base::Passed(&encoded_frame))); |
| 539 } | 543 } |
| 540 | 544 |
| 541 } // namespace cast | 545 } // namespace cast |
| 542 } // namespace media | 546 } // namespace media |
| OLD | NEW |