]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Revert "[mod_opusfile] fix play sample rate (don't use original rate, always use...
authorAndrey Volk <andywolk@gmail.com>
Mon, 6 Jan 2020 18:47:49 +0000 (22:47 +0400)
committerAndrey Volk <andywolk@gmail.com>
Mon, 6 Jan 2020 18:47:49 +0000 (22:47 +0400)
This reverts commit 937c4a03eb032b4b3d1a8a8ad08c777de7a08314.

src/mod/formats/mod_opusfile/mod_opusfile.c

index 71ed372d0326d973d4c0871a1c51633e0ea8353d..418628b8e4b228b78de5f19c33de5ecfb85bb810 100644 (file)
@@ -148,7 +148,7 @@ static switch_status_t switch_opusfile_decode(opus_file_context *context, void *
                        if (globals.debug) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[OGG/OPUS Decoder]: EOF reached [%d]\n", ret);
                        }
-                       context->eof = SWITCH_TRUE;
+                       context->eof = TRUE;
                        break;
                } else /* (ret > 0)*/ {
                        /*The number of samples read per channel on success*/
@@ -161,7 +161,7 @@ static switch_status_t switch_opusfile_decode(opus_file_context *context, void *
                }
        }
        switch_mutex_unlock(context->audio_mutex);
-       context->eof = SWITCH_FALSE; // for next page 
+       context->eof = FALSE; // for next page 
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -282,6 +282,7 @@ static switch_status_t switch_opusfile_open(switch_file_handle_t *handle, const
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS File] Channels: %i\n", head->channel_count);
                        if (head->input_sample_rate) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[OGG/OPUS File] Original sampling rate: %lu Hz\n", (unsigned long)head->input_sample_rate);
+                               handle->samplerate = context->samplerate = head->input_sample_rate;
                        }
                }
                if (op_seekable(context->of)) {
@@ -364,14 +365,14 @@ static switch_status_t switch_opusfile_read(switch_file_handle_t *handle, void *
 
        if (!handle->handler) {
                if (switch_opusfile_decode(context, data, bytes, handle->real_channels) == SWITCH_STATUS_FALSE) {
-                       context->eof = SWITCH_TRUE;
+                       context->eof = 1;
                }
        }
        switch_mutex_lock(context->audio_mutex);
        rb = switch_buffer_read(context->audio_buffer, data, bytes);
        switch_mutex_unlock(context->audio_mutex);
 
-       if (!rb || (context->eof)) {
+       if (!rb && (context->eof)) {
                return SWITCH_STATUS_FALSE;
        }
        if (rb) {