// There are seemingly no direct indicators of sample rate; you just get
// one frame's worth and have to guess from that.
// There are seemingly no direct indicators of sample rate; you just get
// one frame's worth and have to guess from that.
{
size_t num_samples = len / 3 / 8;
size_t num_samples_per_second = num_samples * video_format.frame_rate_nom / video_format.frame_rate_den;
{
size_t num_samples = len / 3 / 8;
size_t num_samples_per_second = num_samples * video_format.frame_rate_nom / video_format.frame_rate_den;
- fprintf(stderr, "%ld samples at %d/%d fps (%ld Hz) matches no known sample rate, assuming 48000 Hz\n",
- num_samples, video_format.frame_rate_nom, video_format.frame_rate_den, num_samples_per_second);
- return 48000;
+ fprintf(stderr, "%ld samples at %d/%d fps (%ld Hz) matches no known sample rate, keeping capture at %d Hz\n",
+ num_samples, video_format.frame_rate_nom, video_format.frame_rate_den, num_samples_per_second, default_rate);
+ return default_rate;
audio_format.id = audio_frame.format;
if (decode_video_format(video_frame.format, &video_format)) {
if (audio_frame.frame.len != 0) {
audio_format.id = audio_frame.format;
if (decode_video_format(video_frame.format, &video_format)) {
if (audio_frame.frame.len != 0) {
last_sample_rate = audio_format.sample_rate;
}
frame_callback(video_timecode,
video_frame.frame, HEADER_SIZE, video_format,
audio_frame.frame, AUDIO_HEADER_SIZE, audio_format);
} else {
last_sample_rate = audio_format.sample_rate;
}
frame_callback(video_timecode,
video_frame.frame, HEADER_SIZE, video_format,
audio_frame.frame, AUDIO_HEADER_SIZE, audio_format);
} else {
audio_format.sample_rate = last_sample_rate;
frame_callback(video_timecode,
FrameAllocator::Frame(), 0, video_format,
audio_format.sample_rate = last_sample_rate;
frame_callback(video_timecode,
FrameAllocator::Frame(), 0, video_format,