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 | |
368 bool H264VideoToolboxEncoder::EncodeVideoFrame( | 364 bool H264VideoToolboxEncoder::EncodeVideoFrame( |
369 const scoped_refptr<media::VideoFrame>& video_frame, | 365 const scoped_refptr<media::VideoFrame>& video_frame, |
370 const base::TimeTicks& reference_time, | 366 const base::TimeTicks& reference_time, |
371 const FrameEncodedCallback& frame_encoded_callback) { | 367 const FrameEncodedCallback& frame_encoded_callback) { |
372 DCHECK(thread_checker_.CalledOnValidThread()); | 368 DCHECK(thread_checker_.CalledOnValidThread()); |
373 DCHECK(!video_frame->visible_rect().IsEmpty()); | 369 DCHECK(!video_frame->visible_rect().IsEmpty()); |
374 DCHECK(!frame_encoded_callback.is_null()); | 370 DCHECK(!frame_encoded_callback.is_null()); |
375 | 371 |
376 if (!compression_session_) { | 372 if (!compression_session_) { |
377 DLOG(ERROR) << " compression session is null"; | 373 DLOG(ERROR) << " compression session is null"; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 CopySampleBufferToAnnexBBuffer(sbuf, &encoded_frame->data, keyframe); | 533 CopySampleBufferToAnnexBBuffer(sbuf, &encoded_frame->data, keyframe); |
538 | 534 |
539 encoder->cast_environment_->PostTask( | 535 encoder->cast_environment_->PostTask( |
540 CastEnvironment::MAIN, FROM_HERE, | 536 CastEnvironment::MAIN, FROM_HERE, |
541 base::Bind(request->frame_encoded_callback, | 537 base::Bind(request->frame_encoded_callback, |
542 base::Passed(&encoded_frame))); | 538 base::Passed(&encoded_frame))); |
543 } | 539 } |
544 | 540 |
545 } // namespace cast | 541 } // namespace cast |
546 } // namespace media | 542 } // namespace media |
OLD | NEW |