| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 311 |
| 312 // config_.renderer must never be null if we're getting this callback. | 312 // config_.renderer must never be null if we're getting this callback. |
| 313 config_.renderer->OnFrame(video_frame); | 313 config_.renderer->OnFrame(video_frame); |
| 314 | 314 |
| 315 // TODO(tommi): OnRenderFrame grabs a lock too. | 315 // TODO(tommi): OnRenderFrame grabs a lock too. |
| 316 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height()); | 316 stats_proxy_.OnRenderedFrame(video_frame.width(), video_frame.height()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 // TODO(asapersson): Consider moving callback from video_encoder.h or | 319 // TODO(asapersson): Consider moving callback from video_encoder.h or |
| 320 // creating a different callback. | 320 // creating a different callback. |
| 321 int32_t VideoReceiveStream::Encoded( | 321 EncodedImageCallback::Result VideoReceiveStream::OnEncodedImage( |
| 322 const EncodedImage& encoded_image, | 322 const EncodedImage& encoded_image, |
| 323 const CodecSpecificInfo* codec_specific_info, | 323 const CodecSpecificInfo* codec_specific_info, |
| 324 const RTPFragmentationHeader* fragmentation) { | 324 const RTPFragmentationHeader* fragmentation) { |
| 325 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info); | 325 stats_proxy_.OnPreDecode(encoded_image, codec_specific_info); |
| 326 if (config_.pre_decode_callback) { | 326 if (config_.pre_decode_callback) { |
| 327 config_.pre_decode_callback->EncodedFrameCallback( | 327 config_.pre_decode_callback->EncodedFrameCallback( |
| 328 EncodedFrame(encoded_image._buffer, encoded_image._length, | 328 EncodedFrame(encoded_image._buffer, encoded_image._length, |
| 329 encoded_image._frameType)); | 329 encoded_image._frameType)); |
| 330 } | 330 } |
| 331 if (kEnableFrameRecording) { | 331 if (kEnableFrameRecording) { |
| 332 if (!ivf_writer_.get()) { | 332 if (!ivf_writer_.get()) { |
| 333 RTC_DCHECK(codec_specific_info); | 333 RTC_DCHECK(codec_specific_info); |
| 334 std::ostringstream oss; | 334 std::ostringstream oss; |
| 335 oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf"; | 335 oss << "receive_bitstream_ssrc_" << config_.rtp.remote_ssrc << ".ivf"; |
| 336 ivf_writer_ = | 336 ivf_writer_ = |
| 337 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); | 337 IvfFileWriter::Open(oss.str(), codec_specific_info->codecType); |
| 338 } | 338 } |
| 339 if (ivf_writer_.get()) { | 339 if (ivf_writer_.get()) { |
| 340 bool ok = ivf_writer_->WriteFrame(encoded_image); | 340 bool ok = ivf_writer_->WriteFrame(encoded_image); |
| 341 RTC_DCHECK(ok); | 341 RTC_DCHECK(ok); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 return 0; | 345 EncodedImageCallback::Result result; |
| 346 result.frame_id = encoded_image._timeStamp; |
| 347 return result; |
| 346 } | 348 } |
| 347 | 349 |
| 348 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { | 350 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { |
| 349 static_cast<VideoReceiveStream*>(ptr)->Decode(); | 351 static_cast<VideoReceiveStream*>(ptr)->Decode(); |
| 350 return true; | 352 return true; |
| 351 } | 353 } |
| 352 | 354 |
| 353 void VideoReceiveStream::Decode() { | 355 void VideoReceiveStream::Decode() { |
| 354 static const int kMaxDecodeWaitTimeMs = 50; | 356 static const int kMaxDecodeWaitTimeMs = 50; |
| 355 video_receiver_.Decode(kMaxDecodeWaitTimeMs); | 357 video_receiver_.Decode(kMaxDecodeWaitTimeMs); |
| 356 } | 358 } |
| 357 | 359 |
| 358 void VideoReceiveStream::SendNack( | 360 void VideoReceiveStream::SendNack( |
| 359 const std::vector<uint16_t>& sequence_numbers) { | 361 const std::vector<uint16_t>& sequence_numbers) { |
| 360 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers); | 362 rtp_stream_receiver_.RequestPacketRetransmit(sequence_numbers); |
| 361 } | 363 } |
| 362 | 364 |
| 363 void VideoReceiveStream::RequestKeyFrame() { | 365 void VideoReceiveStream::RequestKeyFrame() { |
| 364 rtp_stream_receiver_.RequestKeyFrame(); | 366 rtp_stream_receiver_.RequestKeyFrame(); |
| 365 } | 367 } |
| 366 | 368 |
| 367 } // namespace internal | 369 } // namespace internal |
| 368 } // namespace webrtc | 370 } // namespace webrtc |
| OLD | NEW |